Let's write all the positive integer numbers one after another from 1 without any delimiters (i.e. as a single string). It will be the infinite sequence starting with 123456789101112131415161718192021222324252627282930313233343536...

Your task is to print the k-th digit of this sequence.

Input

The first and only line contains integer k (1 ≤ k ≤ 10000) — the position to process (1-based index).

Output

Print the k-th digit of the resulting infinite sequence.

Examples

Input


7


Output


7


Input


21


Output


5
#include <bits/stdc++.h>
using namespace std;
int read() {
  char c = ' ';
  while ((c < '0') || (c > '9')) c = getchar();
  int v = 0;
  while ((c >= '0') && (c <= '9')) {
    v = (v << 1) + (v << 3) + c - '0';
    c = getchar();
  }
  return v;
}
int n;
char ans[] = {
    "01234567891011121314151617181920212223242526272829303132333435363738394041"
    "42434445464748495051525354555657585960616263646566676869707172737475767778"
    "79808182838485868788899091929394959697989910010110210310410510610710810911"
    "01111121131141151161171181191201211221231241251261271281291301311321331341"
    "35136137138139140141142143144145146147148149150151152153154155156157158159"
    "16016116216316416516616716816917017117217317417517617717817918018118218318"
    "41851861871881891901911921931941951961971981992002012022032042052062072082"
    "09210211212213214215216217218219220221222223224225226227228229230231232233"
    "23423523623723823924024124224324424524624724824925025125225325425525625725"
    "82592602612622632642652662672682692702712722732742752762772782792802812822"
    "83284285286287288289290291292293294295296297298299300301302303304305306307"
    "30830931031131231331431531631731831932032132232332432532632732832933033133"
    "23333343353363373383393403413423433443453463473483493503513523533543553563"
    "57358359360361362363364365366367368369370371372373374375376377378379380381"
    "38238338438538638738838939039139239339439539639739839940040140240340440540"
    "64074084094104114124134144154164174184194204214224234244254264274284294304"
    "31432433434435436437438439440441442443444445446447448449450451452453454455"
    "45645745845946046146246346446546646746846947047147247347447547647747847948"
    "04814824834844854864874884894904914924934944954964974984995005015025035045"
    "05506507508509510511512513514515516517518519520521522523524525526527528529"
    "53053153253353453553653753853954054154254354454554654754854955055155255355"
    "45555565575585595605615625635645655665675685695705715725735745755765775785"
    "79580581582583584585586587588589590591592593594595596597598599600601602603"
    "60460560660760860961061161261361461561661761861962062162262362462562662762"
    "86296306316326336346356366376386396406416426436446456466476486496506516526"
    "53654655656657658659660661662663664665666667668669670671672673674675676677"
    "67867968068168268368468568668768868969069169269369469569669769869970070170"
    "27037047057067077087097107117127137147157167177187197207217227237247257267"
    "27728729730731732733734735736737738739740741742743744745746747748749750751"
    "75275375475575675775875976076176276376476576676776876977077177277377477577"
    "67777787797807817827837847857867877887897907917927937947957967977987998008"
    "01802803804805806807808809810811812813814815816817818819820821822823824825"
    "82682782882983083183283383483583683783883984084184284384484584684784884985"
    "08518528538548558568578588598608618628638648658668678688698708718728738748"
    "75876877878879880881882883884885886887888889890891892893894895896897898899"
    "90090190290390490590690790890991091191291391491591691791891992092192292392"
    "49259269279289299309319329339349359369379389399409419429439449459469479489"
    "49950951952953954955956957958959960961962963964965966967968969970971972973"
    "97497597697797897998098198298398498598698798898999099199299399499599699799"
    "89991000100110021003100410051006100710081009101010111012101310141015101610"
    "17101810191020102110221023102410251026102710281029103010311032103310341035"
    "10361037103810391040104110421043104410451046104710481049105010511052105310"
    "54105510561057105810591060106110621063106410651066106710681069107010711072"
    "10731074107510761077107810791080108110821083108410851086108710881089109010"
    "91109210931094109510961097109810991100110111021103110411051106110711081109"
    "11101111111211131114111511161117111811191120112111221123112411251126112711"
    "28112911301131113211331134113511361137113811391140114111421143114411451146"
    "11471148114911501151115211531154115511561157115811591160116111621163116411"
    "65116611671168116911701171117211731174117511761177117811791180118111821183"
    "11841185118611871188118911901191119211931194119511961197119811991200120112"
    "02120312041205120612071208120912101211121212131214121512161217121812191220"
    "12211222122312241225122612271228122912301231123212331234123512361237123812"
    "39124012411242124312441245124612471248124912501251125212531254125512561257"
    "12581259126012611262126312641265126612671268126912701271127212731274127512"
    "76127712781279128012811282128312841285128612871288128912901291129212931294"
    "12951296129712981299130013011302130313041305130613071308130913101311131213"
    "13131413151316131713181319132013211322132313241325132613271328132913301331"
    "13321333133413351336133713381339134013411342134313441345134613471348134913"
    "50135113521353135413551356135713581359136013611362136313641365136613671368"
    "13691370137113721373137413751376137713781379138013811382138313841385138613"
    "87138813891390139113921393139413951396139713981399140014011402140314041405"
    "14061407140814091410141114121413141414151416141714181419142014211422142314"
    "24142514261427142814291430143114321433143414351436143714381439144014411442"
    "14431444144514461447144814491450145114521453145414551456145714581459146014"
    "61146214631464146514661467146814691470147114721473147414751476147714781479"
    "14801481148214831484148514861487148814891490149114921493149414951496149714"
    "98149915001501150215031504150515061507150815091510151115121513151415151516"
    "15171518151915201521152215231524152515261527152815291530153115321533153415"
    "35153615371538153915401541154215431544154515461547154815491550155115521553"
    "15541555155615571558155915601561156215631564156515661567156815691570157115"
    "72157315741575157615771578157915801581158215831584158515861587158815891590"
    "15911592159315941595159615971598159916001601160216031604160516061607160816"
    "09161016111612161316141615161616171618161916201621162216231624162516261627"
    "16281629163016311632163316341635163616371638163916401641164216431644164516"
    "46164716481649165016511652165316541655165616571658165916601661166216631664"
    "16651666166716681669167016711672167316741675167616771678167916801681168216"
    "83168416851686168716881689169016911692169316941695169616971698169917001701"
    "17021703170417051706170717081709171017111712171317141715171617171718171917"
    "20172117221723172417251726172717281729173017311732173317341735173617371738"
    "17391740174117421743174417451746174717481749175017511752175317541755175617"
    "57175817591760176117621763176417651766176717681769177017711772177317741775"
    "17761777177817791780178117821783178417851786178717881789179017911792179317"
    "94179517961797179817991800180118021803180418051806180718081809181018111812"
    "18131814181518161817181818191820182118221823182418251826182718281829183018"
    "31183218331834183518361837183818391840184118421843184418451846184718481849"
    "18501851185218531854185518561857185818591860186118621863186418651866186718"
    "68186918701871187218731874187518761877187818791880188118821883188418851886"
    "18871888188918901891189218931894189518961897189818991900190119021903190419"
    "05190619071908190919101911191219131914191519161917191819191920192119221923"
    "19241925192619271928192919301931193219331934193519361937193819391940194119"
    "42194319441945194619471948194919501951195219531954195519561957195819591960"
    "19611962196319641965196619671968196919701971197219731974197519761977197819"
    "79198019811982198319841985198619871988198919901991199219931994199519961997"
    "19981999200020012002200320042005200620072008200920102011201220132014201520"
    "16201720182019202020212022202320242025202620272028202920302031203220332034"
    "20352036203720382039204020412042204320442045204620472048204920502051205220"
    "53205420552056205720582059206020612062206320642065206620672068206920702071"
    "20722073207420752076207720782079208020812082208320842085208620872088208920"
    "90209120922093209420952096209720982099210021012102210321042105210621072108"
    "21092110211121122113211421152116211721182119212021212122212321242125212621"
    "27212821292130213121322133213421352136213721382139214021412142214321442145"
    "21462147214821492150215121522153215421552156215721582159216021612162216321"
    "64216521662167216821692170217121722173217421752176217721782179218021812182"
    "21832184218521862187218821892190219121922193219421952196219721982199220022"
    "01220222032204220522062207220822092210221122122213221422152216221722182219"
    "22202221222222232224222522262227222822292230223122322233223422352236223722"
    "38223922402241224222432244224522462247224822492250225122522253225422552256"
    "22572258225922602261226222632264226522662267226822692270227122722273227422"
    "75227622772278227922802281228222832284228522862287228822892290229122922293"
    "22942295229622972298229923002301230223032304230523062307230823092310231123"
    "12231323142315231623172318231923202321232223232324232523262327232823292330"
    "23312332233323342335233623372338233923402341234223432344234523462347234823"
    "49235023512352235323542355235623572358235923602361236223632364236523662367"
    "23682369237023712372237323742375237623772378237923802381238223832384238523"
    "86238723882389239023912392239323942395239623972398239924002401240224032404"
    "24052406240724082409241024112412241324142415241624172418241924202421242224"
    "23242424252426242724282429243024312432243324342435243624372438243924402441"
    "24422443244424452446244724482449245024512452245324542455245624572458245924"
    "60246124622463246424652466246724682469247024712472247324742475247624772478"
    "24792480248124822483248424852486248724882489249024912492249324942495249624"
    "97249824992500250125022503250425052506250725082509251025112512251325142515"
    "25162517251825192520252125222523252425252526252725282529253025312532253325"
    "34253525362537253825392540254125422543254425452546254725482549255025512552"
    "25532554255525562557255825592560256125622563256425652566256725682569257025"
    "71257225732574257525762577257825792580258125822583258425852586258725882589"
    "25902591259225932594259525962597259825992600260126022603260426052606260726"
    "08260926102611261226132614261526162617261826192620262126222623262426252626"
    "26272628262926302631263226332634263526362637263826392640264126422643264426"
    "45264626472648264926502651265226532654265526562657265826592660266126622663"
    "26642665266626672668266926702671267226732674267526762677267826792680268126"
    "82268326842685268626872688268926902691269226932694269526962697269826992700"
    "27012702270327042705270627072708270927102711271227132714271527162717271827"
    "19272027212722272327242725272627272728272927302731273227332734273527362737"
    "27382739274027412742274327442745274627472748274927502751275227532754275527"
    "56275727582759276027612762276327642765276627672768276927702771277227732774"
    "277527762777"};
int main() {
  n = read();
  printf("%c", ans[n]);
  return ~~(0 - 0);
}
