p374.py
======================
def mult_poly(poly1, poly2):
    res = [0] * (len(poly1) + len(poly2) - 1)
    for i in range(len(poly1)):
        for j in range(len(poly2)):
            res[i + j] += poly1[i] * poly2[j]
    return res


def main():
    a, b, k = map(int, input().split())

    poly = [b, a]
    res = [1]
    while k > 0:
        if k % 2 == 1:
            res = mult_poly(poly, res)
        poly = mult_poly(poly, poly)
        k >>= 1

    print(sum(res))
    

if __name__ == "__main__":
    main()

=================
statement.txt
======================
374. Save Vasya
Time limit per test: 0.25 second(s)
Memory limit: 65536 kilobytes
input: standard
output: standard



Vasya has huge problems. He needs to take polynomial ax + b, then calculate its k-th power and evaluate the sum of its coefficients. Your task is to help him.

Input
The first line of the input contains three integers a, b and k (1 ≤ a, b≤ 100, 1≤ k≤ 20).

Output
The first line must contain the sum of coefficients of the resulting polynomial.

Example(s)
sample input
sample output
1 2 2

=================
