#include using namespace std; using ll = long long; int main () { // A(N-4b-1)-B(N-2b) = (2B - 4A)b ll A, B, N; cin >> A >> B >> N; ll ans = 0; if (N % 2 == 0) { ans = A * (1 - N); } if (2*B - 4*A < 0) { ll b = (N-1)/2; ans = min(ans, A * (N - 4*b - 1) - B * (N - 2*b)); } else { ll b = 0; ans = min(ans, A * (N - 4*b - 1) - B * (N - 2*b)); } cout << ans << endl; }