Hide

Problem N
Undratré

Languages en is

Unnur has an interest in plants. She waters all her plants once a day. Most of the plants are rather normal, but one of her trees is especially odd and unique. That’s Unnur’s wondertree. The wondertree is originally just a branch sticking out of the ground, but that branch is often called the root of the wondertree. The wondertree is special in the sense that it grows differently depending on where you water it. If a branch is watered then another branch will grow from it. The same branch can not be watered too often, if a branch is watered more than $k$ times the tree wilts and dies. Unnur waters exactly one branch per day. If a branch has never been watered it is called a leaf. The wondertree thus always has at least one leaf. The width of the wondertree is defined as the number of leaves. The width of the wondertree is defined as the number of leaves. The width of the wondertree is thus initially $1$. The height of the wondertree is defined as the number of branches in the longest path from the root to a leaf, including the root and the leaf. Thus the height of the wondertree is initially $1$. Unnur wonders how wide and high the wondertree could be in $n$ days. Can you help her?

Input

The first and only line of the input contains two integers $n$ and $k$, the number of days and how often each branch can be watered.

Output

Two lines where the frst line contains the minimum and maximum height possible after $n$ days. The second line should contain the minimum and maximum width possible after $n$ days.

Scoring

Grou

Points

Constraints

1

50

$0 \leq n \leq 10^{9}$, $k = 2$

2

50

$0 \leq n \leq 10^{15}$, $1 \leq k \leq 10^4$

Sample Input 1 Sample Output 1
5 2
3 6
1 3
Sample Input 2 Sample Output 2
14 2
4 15
1 8
Sample Input 3 Sample Output 3
14 5
3 15
1 12

Please log in to submit a solution to this problem

Log in