#include #include #include #include #define ll long long using namespace std; int main() { int a,b,c,d,e,cnt; int ans=0; cin>>a>>b>>c>>d>>e; int cost=d; cnt=(b-c)*a; if(cnt==1 or cnt==0) ans=cnt*d; else { ans+=d; for (int i=2;i<=cnt;i++){ if(i%10!=0) { ans+=cost; } else if(i%10==0 and e<=cost) { cost=(d-e); ans+=cost; } else if(i%10==0 and e>cost){ ans+=cost; } } } cout<