QOJ.ac

QOJ

حد الوقت: 1 s حد الذاكرة: 512 MB مجموع النقاط: 100

#7809. Small Apples

الإحصائيات

There are $n$ apples on Little Y's table, arranged in a row from left to right, numbered from $1$ to $n$.

Little Bao is a good friend of Little Y, and every day she takes away some apples.

Each day, when taking apples, Little Bao starts from the first apple on the left and takes one apple every three apples (i.e., she takes the 1st, 4th, 7th, ... apples).

Afterward, Little Bao rearranges the remaining apples in a row in their original order.

Little Bao wants to know how many days it will take to finish all the apples, and on which day the apple numbered $n$ is taken.

Input

The input consists of a single positive integer $n$, representing the total number of apples.

Output

Output a single line containing two positive integers separated by a space, representing the number of days it takes for Little Bao to take all the apples and the day on which the apple numbered $n$ is taken, respectively.

Constraints

For all test data, $1 \le n \le 10^9$.

Test Cases $n \le$ Special Property
$1 \sim 2$ $10$ None
$3 \sim 5$ $10^3$ None
$6 \sim 7$ $10^6$ Yes
$8 \sim 9$ $10^6$ None
$10$ $10^9$ None

Special property: Little Bao takes the apple numbered $n$ on the first day.

Examples

Input 1

8

Output 1

5 5

Note

There are a total of $8$ apples on Little Bao's table. On the first day, Little Bao takes apples numbered $1, 4, 7$. On the second day, Little Bao takes apples numbered $2, 6$. On the third day, Little Bao takes apple numbered $3$. On the fourth day, Little Bao takes apple numbered $5$. On the fifth day, Little Bao takes apple numbered $8$.

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.