{"problem":{"name":"Takahashi Unevolved","description":{"content":"Iroha is into a game where you keep pets. Iroha's pet is Takahashi. Initially, Takahashi's **STR** and **EXP** are $X$ and $0$, respectively. These parameters increase in the following two kinds of tr","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"abc180_d"},"statements":[{"statement_type":"Markdown","content":"Iroha is into a game where you keep pets.\nIroha's pet is Takahashi. Initially, Takahashi's **STR** and **EXP** are $X$ and $0$, respectively. These parameters increase in the following two kinds of training:\n\n*   Go to Kakomon Gym: the STR gets multiplied by $A$, and the EXP increases by $1$.\n*   Go to AtCoder Gym: the STR increases by $B$, and the EXP increases by $1$.\n\nTakahashi evolves when his STR becomes $Y$ or greater, but Iroha thinks that makes him less cute.\nFind the maximum possible EXP of Takahashi when he is trained without letting him evolve.\n\n## Constraints\n\n*   $1 \\leq X < Y \\leq 10^{18}$\n*   $2 \\leq A \\leq 10^9$\n*   $1 \\leq B \\leq 10^9$\n*   All values in input are integers.\n\n## Input\n\nInput is given from Standard Input in the following format:\n\n$X$ $Y$ $A$ $B$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"abc180_d","tags":[],"sample_group":[["4 20 2 10","2\n\nInitially, Takahashi's STR is $4$. We can make his EXP $2$ in the following course of training:\n\n*   First, go to Kakomon Gym, which makes his STR $8$ and his EXP $1$.\n*   Then, go to AtCoder Gym, which makes his STR $18$ and his EXP $2$.\n\nOn the other hand, there is no way to train him so that his EXP becomes greater than $2$."],["1 1000000000000000000 10 1000000000","1000000007\n\nWatch out for overflows."]],"created_at":"2026-03-03 11:01:14"}}