#include using namespace std; long long m=1000000007; int main() { long long a, d, n; cin >> a >> d >> n; long long n1=n-1; int n2=n%m; if (n%2==0) n=n/2; else n1=n1/2; long long z=((n2 * (a%m))%m + (((n%m) * (n1%m))%m * (d%m))%m)%m; if (z<0) z+=m; cout << z; return 0; }