A, B, C, D, E = map(int, input().strip().split(' ')) cnt = (B - C) * A amt = D for i in range(2, cnt + 1): if i % 10 == 0 and E <= D: D -= E amt += D print(amt)