#include #include using namespace std; typedef long long ll; typedef vector> vvl; ll n,mod = 1000000007; vvl mul(const vvl &a,const vvl &b){ vvl c(n,vector(n,0)); int i,j,k; for(i=0;i(n,0)),b(n,vector(n,0)); int i,j,k; for(i=0;i mul2(const vvl &a, const vector &b){ vector c(n,0); int i,j; for(i=0;i> a >> b >> x; n = 2; vector v(2,0); v[0] = 1; vvl m(2,vector(2,0)); m[0][0] = a; m[0][1] = b; m[1][0] = 1; m = pw(m,x); cout << mul2(m,v)[1] << endl; }