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+1)%10 != 0 or i == 0: Ame_cost = Ame_cost + X elif (i+1)%10 == 0 and E <= X: X = X - E Ame_cost = Ame_cost + X elif (i+1)%10 == 0 and E > X: Ame_cost = Ame_cost + X else: pass #print(i, X, Ame_cost) print(Ame_cost)