#Lutece2353. Cooking

Cooking

Migrated from Lutece 2353 Cooking

All parts of this problem, including description, images, samples, data and checker, might be broken. If you find bugs in this problem, please contact the admins.

Description

Potter needs to cook nn pieces of beef. Cooking a piece of beef needs mm steps and each step takes tt minutes. It's not necessary to cook a piece of beef continueously, which means after finishing one step, he can set the beef aside and cook another one. Potter is a skilled cook that he can deal with at most kk different pieces of beef at the same time.

Potter want to finish it as soon as possible. Please help him calculate how long will it take to finish cooking ?

Input

n,m,k,tn,m,k,t

Output

An integer TT, indicating that Potter has to spend at least TT minutes on cooking.

Samples

3 2 2 3
9

Constraints

1n,m,k,t1001≤n,m,k,t≤100

Note

n=3 m=2 k=2 t=3

At the beginning : (0,0,0)

3min to deal with the first and the second : (1,1,0)

3min to deal with the first and the third : (2,1,1)

3min to deal with the second and the third : (2,2,2)

It takes 9 min totally.

Resources

电子科技大学第十届ACM趣味程序设计竞赛