a,b,c,d,e = map(int,input().split())
t = 0
v = d
for i in range(1, a*(b-c)+1):
	if i >= 2:
		if i % 10 == 0 and e <= v:
			v -= e
	t += v

print(t)