Marcia loves to knit, and she wants to know how many stitches a project will take to complete.
Every project starts with a first row containing a given number of stitches. Each later row is obtained from the previous row by adding a value taken from a fixed, repeating pattern. A positive value increases the number of stitches, a negative value decreases it, and $0$ leaves it unchanged. After the pattern's last value is used, it repeats from the beginning.
For example, a triangular shawl might start with $3$ stitches and add $2$ stitches on every following row. Then the rows have $3$, $5$, $7$, $\ldots$ stitches, and a project of $3$ rows uses $3 + 5 + 7 = 15$ stitches in total.
A scarf might use a $4$-row repeating pattern that adds $6$, then subtracts $2$, subtracts $2$, and finally changes nothing. Starting from $50$ stitches, the rows have $50$, $56$, $54$, $52$, $52$, and (as the pattern repeats) $58$ stitches. A $6$-row project therefore uses $50 + 56 + 54 + 52 + 52 + 58 = 322$ stitches.
Given the description of one or more projects, compute the total number of stitches each project takes to complete.
The input describes one or more projects. Each project is given on two lines.
The first line contains three integers:
N M K
where $N$ ($1 \le N \le 100$) is the number of stitches in the first row, $M$ ($1 \le M \le 1000$) is the total number of rows, and $K$ ($1 \le K \le 100$) is the number of rows in the repeating pattern.
The second line contains exactly $K$ integers, each between $-100$ and $100$ inclusive, describing the pattern: a negative value decreases the stitch count, a positive value increases it, and $0$ leaves it unchanged. No project's pattern ever makes a row have $0$ or fewer stitches.
The end of input is a line containing three zeros (0 0 0), which is not part of any project.
For each project, print the total number of stitches in the completed project on its own line, in the order the projects are given, with no blank lines between the answers.