#include <iostream>
using namespace std;
int main(){
int a, b, c, d, e;
cin >> a >> b >> c >> d >> e;
a = (a - b) + (c * e) -((d / 2) * e);
cout << a;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IG1haW4oKXsKICBpbnQgYSwgYiwgYywgZCwgZTsKICBjaW4gPj4gYSA+PiBiID4+IGMgPj4gZCA+PiBlOwogIGEgPSAoYSAtIGIpICsgKGMgKiBlKSAtKChkIC8gMikgKiBlKTsKICBjb3V0IDw8IGE7CiAgcmV0dXJuIDA7Cn0=