//133333333333333333 var fs = require('fs'); var length = fs.fstatSync(process.stdin.fd).size; var buffer = Buffer.alloc(length); var bytesRead = fs.readSync(process.stdin.fd, buffer, 0, length, 0); var input = buffer.toString('utf8', 0, bytesRead); //var input="133333333333333333";//"1000000006"; //var input="1000000000000000000"; var m=1000000007n; // u1 = um var n=BigInt(input); n=(n-1n)%(m-1n)+1n; n=(n+"").replace("n","")-0; m=(m+"").replace("n","")-0; const PITCH=10000000; var cache=[693786035,590628878,237899936,859545643,926415565,233422050,794894811,851187198,143283872,263119286,405325043,650312175,21449757,496238477,519220205,901183890,3023425,695342322,725638401,516955262,41264170,202362364,601547206,819822969,690626643,64828682,132815103,496752609,718786042,804446123,979931491,633545932,638714794,825511696,683473922,132554980,719048317,352803603,620916882,787569727,137735182,556034422,509340893,408942294,809708437,935818482,78671884,256316801,106178901,857333339,718639552,267742706,562095437,662473792,508406921,864099917,686538443,27482146,410190052,612070218,862928014,738683026,965311890,924837101,28814113,983432156,489330313,759637996,56607695,179816379,24292069,766130976,171731787,280513512,662642711,240268506,443200521,800836586,719614552,302528889,926353408,989699794,255694620,241507823,559649863,854200784,44614285,942980536,839712422,674545768,740195603,59777299,412823995,755924396,204523626,639397519,126254662,257077018,557227158,190476001]; //var chk=263119286; var i,b; if (n>=PITCH) { b=cache[Math.floor(n/PITCH)-1]; i=Math.floor(n/PITCH)*PITCH; } else { b=13; i=1; } for (; is.substring(s.length-9))("00000000"+b)); } console.log(b); //console.log(JSON.stringify(cache));