// mc3a.cpp : Defines the entry point for the console application. // #include using namespace std; long long a, b, n, i; int main() { cin >> a >> b >> n; if (n == 2) { cout << a * 1 + b << " " << a * 2 + b; return 0; } long long first = a * 1LL + b; long long last; long long index = n; long long pindex = 1LL; while (n > 2) { if (n % 2 == 0) { index -= pindex; pindex *= 2LL; n = n / 2LL; } else { pindex *= 2LL; n = n / 2LL + 1; } } last = a*index + b; //last = a*i + b; /*if (n % 2LL == 0LL) { last = a * (n - 1LL) + b; } else { last = a * n + b; }*/ cout << first << " " << last; }