#P1635. 跳跃

跳跃

Description

Little Frog C heard that NOIP will hold an anniversary contest and excitedly came to Z City. Initially, he is at coordinate x0x_0. Little Frog C is good at jumping: if he is currently at coordinate xx, with each jump he can move to 4x+34x+3 or 8x+78x+7. Due to stamina limits, he can make at most 100000100000 jumps.

According to the legend of Z City, any position whose coordinate is a multiple of 109+710^9+7 (e.g., 109+7,2×109+1410^9+7,2\times 10^9+14) can teleport to YZOJ.

Little Frog C wants to know the minimum number of jumps needed to teleport to YZOJ.

Input Format

The first line contains an integer x0x_0, the frog’s initial position, guaranteed to be in the range [1,109+6][1,10^9+6].

Output Format

Output a single integer, the minimum required number of steps. If he still cannot teleport to YZOJ within 100000100000 steps, output 1-1.

125000000 
1

Hint

Translated by ChatGPT 5