#include <iostream>
using namespace std;
int main() {
int a, b, c, d, e, nr;
cin >> a >> b >> c >> d >> e;
nr = a - b + (e * c) - ((e / 2)*d);
cout <<nr;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IG1haW4oKSB7CgoJaW50IGEsIGIsIGMsIGQsIGUsIG5yOwogICAgY2luID4+IGEgPj4gYiA+PiBjID4+IGQgPj4gZTsKICAgIG5yID0gYSAtIGIgKyAoZSAqIGMpIC0gKChlIC8gMikqZCk7CiAgICBjb3V0IDw8bnI7CglyZXR1cm4gMDsKfQ==