eolymp
bolt
Try our new interface for solving problems
Problems

TripleK

TripleK

\textit{"Do not worry about your problems with mathematics, I assure you mine are far greater."} \textit{Albert Einstein} MCA land's residents love lollipop. Koosha and Keivan are from MCA. They like lollipop more than each other. Kaveh wins trophy a lot of lollipops in the war against ACM land's residents. He wants to divide these lollipops between Koosha and Keivan, MCA resident lollipop lovers. Considering that if one of them eat more than \textbf{7} lollipops, affected by tooth pain, Kaveh decides to divide entire lollipops so that amount of lollipops that gained by them are less or equal than \textbf{7}. Koosha and Kaveh always can trust Keivan about lollipop division and never protest until everyone gained at least one lollipop and Keivan never likes to broken their relationship. There is another problem that these three friends must solve it. Koosha and Kaveh put their lollipops in their personal packets. Each one has an equal number of packets on their clothes. They must put equal number of lollipops in their packets. Otherwise for example if the number of lollipops in Koosha’s packets are not equal, he can't maintain his balance and will fall to the ground. For example assume Keivan wants to divide \textbf{10} lollipops between Koosha and Kaveh and maximum numer of lollipops that everyone can gain are \textbf{7}. Each one has two packets. So there are \textbf{2} possible cases: Koosha gain \textbf{4} lollipops and Kaveh gain \textbf{6} and vice versa. If number of lollipop lovers be \textbf{2}, the problem, number of cases that this division is possible, is easy to solve, but TripleK (Keivan, Kaveh and Koosha) need to find the answer for arbitrary number of lollipop lovers, arbitrary number of lollipops, arbitrary number of maximum values and arbitrary number of packets. \InputFile Input file has several test cases. Each test case on a single line separated by a space character. First integer number \textbf{m} in test cases is number of lollipops that \textbf{0} < \textbf{m} ≤ \textbf{60}. Second integer number \textbf{n} is number of lollipop lovers that \textbf{0} < \textbf{n} ≤ \textbf{m}. Maximum number of lollipops that each person can gain is third integer number \textbf{p}, that \textbf{0} < \textbf{p} ≤ \textbf{m}. All people's clothes has \textbf{k} (\textbf{k} ≤ \textbf{m} and \textbf{m mod k = 0}) packets that is forth integer number. These people love lollipop so it's possible that clothes have a lot of packets. Don't surprise! \OutputFile For each line of input print a single integer number in a separate line that indicates number of possible way to divide all lollipops between people.
Time limit 1 second
Memory limit 64 MiB
Input example #1
10 2 7 2
2 1 1 1
Output example #1
2
0