# 1453 : 手助け from sys import stdin candiesPerPerson,inviting,noComing,price,borderPrice=list(map(int,stdin.readline().split())) numComing=inviting-noComing cost=0 candies=candiesPerPerson*numComing if candies!=0: cost+=price priceIm1=price for i in range(2,candies+1): if i%10!=0: cost+=priceIm1 else: if priceIm1>=borderPrice: cost+=(priceIm1-borderPrice) priceIm1-=borderPrice else: cost+=priceIm1 else: cost=0 print(cost)