#include using namespace std; typedef long long int ll; typedef pair P; typedef vector VI; typedef vector VVI; #define REP(i,n) for(int i=0;i<(n);i++) #define ALL(v) v.begin(),v.end() constexpr ll MOD=1000000007; constexpr ll INF=2e18; int main(){ int a, b, c, d, e; cin >> a >> b >> c >> d >> e; int ans=0, x=d; REP(i,a*(b-c)){ if(i%10==9&&e<=x) x-=e; ans+=x; } cout << ans << endl; return 0; }