Multiples of seven

For every natural nn, let X(n)X(n) be the smallest natural mm such that mm ends with nn and mm is a multiple of 7. For instance, X(1)=21X(1) = 21, X(2)=42X(2) = 42, X(3)=63X(3) = 63, …, X(7)=7X(7) = 7, X(8)=28X(8) = 28, X(9)=49X(9) = 49, X(10)=210X(10) = 210, X(11)=511X(11) = 511, … Let SS be the infinite concatenation of X(i)X(i) for every i1i \ge 1, that is, S=21426314355672849210511...S = 21426314355672849210511.... Which is the ii-th digit of SS?

Input

Input consists of several cases, each with a natural ii between 1 and 101510^{15}.

Output

For every ii, print the ii-th digit of SS (starting at one).

Problem information

Author: Salvador Roura

Generation: 2026-01-25T11:55:25.375Z

© Jutge.org, 2006–2026.
https://jutge.org