A,B,C,D,E = map(int,input().split()) if B-C == 0: print(0) exit() B -= C candy = A * B ans = 0 for i in range(candy): if i+1 == 1: ans += D else: if (i+1)%10 == 0: if E <= D: ans += (D - E) else: ans += D else: ans += D print(ans)