A, B, C, D, E = map(int, input().strip().split()) Ame_num = A*(B-C) X=D Ame_cost=0 for i in range(Ame_num): if i%10 != 0: Ame_cost = Ame_cost + X elif i%10 == 0 and E <= X: X = X - E Ame_cost = Ame_cost + X elif i%10 == 0 and E > X: Ame_cost = Ame_cost + X else: pass print(Ame_cost)