#include <bits/stdc++.h>
using namespace std;
int main() {
string s;
getline(cin, s); // read the full line like "1+3+..."
int a, b;
// Find positions of '+' signs
size_t plus1 = s.find('+');
size_t plus2 = s.find('+', plus1 + 1);
if (plus1 == string::npos || plus2 == string::npos) {
cerr << "Invalid input format\n";
return 1;
}
// Extract a and b
a = stoi(s.substr(0, plus1));
b = stoi(s.substr(plus1 + 1, plus2 - plus1 - 1));
// Read the last term
int last;
cin >> last;
int d = b - a;
int sum = (2 * a + (last - 1) * d) * last / 2;
cout << sum << "\n";
return 0;
}