Salary
Time limit2sMemory limit1024 MB
Given k up to 10^18, find the k-th digit of the string formed by writing the cubes 1, 8, 27, 64, ... one after another.
- Level
Medium6 of 10
- Topics
- Math, Binary search, Implementation
- Solved
- No attempts yet
Problem
Dima has just started a job. Since he is a very valuable employee, his salary grows not by the day but by the hour. More precisely, each month his salary in rubles equals the month number cubed. So he gets ruble in the first month, in the second, in the third, and so on.
Tax calculation
Tax laws are complicated. Recently the country where Dima works passed a new law. Under it, the percentage of tax an employee pays each month is computed as follows.
- Write the salary for the first month, append the salary for the second month to its right, then the third, and so on, until the total number of digits in the written number is greater than .
- The -th digit of the written number is the tax percentage.
Each organization has its own . Dima knows the value for his organization and wants to know what percentage of his salary he will pay as tax each month.
Input
The first line of the input file contains one integer ().
Output
Print to the output file one integer (), the required percentage.
Hint
For the written string is , and its seventh digit is .