#include using namespace std; ifstream fin("planta.in"); ofstream fout("planta.out"); int main() { int d,a,b,n,i; fin >> d >> a >> b >> n; int z = n / 2; d = d + a * z - b * z; if (n % 2 == 1) { d = d + a; } fout << d; return 0; }