A, B, C, D, E = map(int, input().split()) K = A * (B - C) KAI = 0 for i in range(1, K + 1): if i % 10 != 0: KAI += D elif i % 10 == 0 and E <= D: KAI += (D - E) elif i % 10 == 0 and E > D: KAI += D print(KAI)