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 Ame_num%10 == 0 & E <= X: Ame_cost = Ame_cost + (X-E) elif Ame_num%10 == 0 & E > X: Ame_cost = Ame_cost + X else: Ame_cost = Ame_cost + D print(Ame_cost)