18 lines
254 B
C++
18 lines
254 B
C++
#include <fstream>
|
|
|
|
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;
|
|
}
|