Problem:
Score : 300 points

Problem Statement

1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows:

the dogs numbered 1,2,\cdots,26 were respectively given the names a, b, ..., z;

the dogs numbered 27,28,29,\cdots,701,702 were respectively given the names aa, ab, ac, ..., zy, zz;

the dogs numbered 703,704,705,\cdots,18277,18278 were respectively given the names aaa, aab, aac, ..., zzy, zzz;

the dogs numbered 18279,18280,18281,\cdots,475253,475254 were respectively given the names aaaa, aaab, aaac, ..., zzzy, zzzz;

the dogs numbered 475255,475256,\cdots were respectively given the names aaaaa, aaaab, ...;

and so on.

To sum it up, the dogs numbered 1, 2, \cdots were respectively given the following names:

a, b, ..., z, aa, ab, ..., az, ba, bb, ..., bz, ..., za, zb, ..., zz, aaa, aab, ..., aaz, aba, abb, ..., abz, ..., zzz, aaaa, ...

Now, Roger asks you:

"What is the name for the dog numbered N?"

Constraints

N is an integer.

1 \leq N \leq 1000000000000001

Input

Input is given from Standard Input in the following format:

N

Output

Print the answer to Roger's question as a string consisting of lowercase English letters.

Sample Input 1

2

Sample Output 1

b

Sample Input 2

27

Sample Output 2

aa

Sample Input 3

123456789

Sample Output 3

jjddja

Solution in Python (3.8.2) (judge verdict: Runtime Error)

from itertools import product
from string import ascii_lowercase
import math
import sys
n=int(input())
i=0
alphabets = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
if n<=26:
    for combo in product(ascii_lowercase, repeat=1):
        if i==n-1:
            print(''.join(combo))
        i+=1
elif n<=702:
    for combo in product(ascii_lowercase, repeat=2):
        if i==n-26-1:
            print(''.join(combo))
        i+=1
elif n<=18278:
    for combo in product(ascii_lowercase, repeat=3):
        if i==n-702-1:
            print(''.join(combo))
        i+=1
elif n<=475254:
    for combo in product(ascii_lowercase, repeat=4):
        if i==n-18278-1:
            print(''.join(combo))
        i+=1
elif n<= 12356630:
    if n==12356630:
        print("zzzzz")
        sys.exit()
    n=n-475254
    p=math.floor(n/456976)
    n=n%456976
    for combo in product(ascii_lowercase, repeat=4):
        if i==n-1:
            print(alphabets[p]+''.join(combo))
        i+=1
elif n<=321272406:
    if n==321272406:
        print("zzzzzz")
        sys.exit()
    n=n-12356630
    p=math.floor(n/11881376)
    n=n%11881376
    if n==12356630:
        print(alphabets[p]+"zzzzz")
    t=math.floor(n/456976)
    n=n%456976
    for combo in product(ascii_lowercase, repeat=4):
        if i==n-1:
            print(alphabets[p]+alphabets[t]+''.join(combo))
        i+=1
elif n<=8353082582:
    if n==8353082582:
        print("zzzzzzz")
        sys.exit()
    n=n-321272406
    p=math.floor(n/308915776)
    n=n%308915776
    if n==321272406:
        print(alphabets[p]+"zzzzzz")
    u=math.floor(n/11881376)
    n=n%11881376
    if n==12356630:
        print(alphabets[p]+alphabets[u]+"zzzzz")
    t=math.floor(n/456976)
    n=n%456976
    for combo in product(ascii_lowercase, repeat=4):
        if i==n-1:
            print(alphabets[p]+alphabets[u]+alphabets[t]+''.join(combo))
        i+=1
elif n<=217180147158:
    if n==217180147158:
        print("zzzzzzzz")
        sys.exit()
    n=n-8353082582
    p=math.floor(n/8031810176)
    n=n%8031810176
    if n==8353082582:
        print(alphabets[p]+"zzzzzzz")
    n=n-321272406
    o=math.floor(n/308915776)
    n=n%308915776
    if n==321272406:
        print(alphabets[p]+alphabets[o]+"zzzzzz")
    u=math.floor(n/11881376)
    n=n%11881376
    if n==12356630:
        print(alphabets[p]+alphabets[o]+alphabets[u]+"zzzzz")
    t=math.floor(n/456976)
    n=n%456976
    for combo in product(ascii_lowercase, repeat=4):
        if i==n-1:
            print(alphabets[p]+alphabets[o]+alphabets[u]+alphabets[t]+''.join(combo))
        i+=1
elif n<=5646683826134:
    if n==5646683826134:
        print("zzzzzzzzz")
        sys.exit()
    n=n-217180147158
    p=math.floor(n/208827064576)
    n=n%208827064576
    if n==217180147158:
        print(alphabets[p]+"zzzzzzzz")
        sys.exit()
    v=math.floor(n/8031810176)
    n=n%8031810176
    if n==8353082582:
        print(alphabets[p]+alphabets[v]+"zzzzzzz")
    n=n-321272406
    o=math.floor(n/308915776)
    n=n%308915776
    if n==321272406:
        print(alphabets[p]+alphabets[v]+alphabets[o]+"zzzzzz")
    u=math.floor(n/11881376)
    n=n%11881376
    if n==12356630:
        print(alphabets[p]+alphabets[v]+alphabets[o]+alphabets[u]+"zzzzz")
    t=math.floor(n/456976)
    n=n%456976
    for combo in product(ascii_lowercase, repeat=4):
        if i==n-1:
            print(alphabets[p]+alphabets[v]+alphabets[o]+alphabets[u]+alphabets[t]+''.join(combo))
        i+=1
elif n<=146813779479510:
    if n==146813779479510:
        print("zzzzzzzzzz")
        sys.exit()
    n=n-5646683826134
    p=math.floor(n/5429503678976)
    n=n%5429503678976
    if n==5646683826134:
        print(alphabets[p]+"zzzzzzzzz")
        sys.exit()
    l=math.floor(n/208827064576)
    n=n%208827064576
    if n==217180147158:
        print(alphabets[p]+alphabets[l]+"zzzzzzzz")
        sys.exit()
    v=math.floor(n/8031810176)
    n=n%8031810176
    if n==8353082582:
        print(alphabets[p]+alphabets[l]+alphabets[v]+"zzzzzzz")
    n=n-321272406
    o=math.floor(n/308915776)
    n=n%308915776
    if n==321272406:
        print(alphabets[p]+alphabets[l]+alphabets[v]+alphabets[o]+"zzzzzz")
    u=math.floor(n/11881376)
    n=n%11881376
    if n==12356630:
        print(alphabets[p]+alphabets[l]+alphabets[v]+alphabets[o]+alphabets[u]+"zzzzz")
    t=math.floor(n/456976)
    n=n%456976
    for combo in product(ascii_lowercase, repeat=4):
        if i==n-1:
            print(alphabets[p]+alphabets[l]+alphabets[v]+alphabets[o]+alphabets[u]+alphabets[t]+''.join(combo))
        i+=1
else:
    n=n-146813779479510
    p=math.floor(n/141167095653376)
    n=n%141167095653376
    
    if n==146813779479510:
        print("zzzzzzzzzz")
        sys.exit()
    p=math.floor(n/141167095653376)
    n=n%141167095653376
    
    if n==5646683826134:
        print(alphabets[p]+alphabets[k]+"zzzzzzzzz")
        sys.exit()
    l=math.floor(n/208827064576)
    n=n%208827064576
    if n==217180147158:
        print(alphabets[p]+alphabets[k]+alphabets[l]+"zzzzzzzz")
        sys.exit()
    v=math.floor(n/8031810176)
    n=n%8031810176
    if n==8353082582:
        print(alphabets[p]+alphabets[k]+alphabets[l]+alphabets[v]+"zzzzzzz")
    n=n-321272406
    o=math.floor(n/308915776)
    n=n%308915776
    if n==321272406:
        print(alphabets[p]+alphabets[k]+alphabets[l]+alphabets[v]+alphabets[o]+"zzzzzz")
    u=math.floor(n/11881376)
    n=n%11881376
    if n==12356630:
        print(alphabets[p]+alphabets[k]+alphabets[l]+alphabets[v]+alphabets[o]+alphabets[u]+"zzzzz")
    t=math.floor(n/456976)
    n=n%456976
    for combo in product(ascii_lowercase, repeat=4):
        if i==n-1:
            print(alphabets[p]+alphabets[k]+alphabets[l]+alphabets[v]+alphabets[o]+alphabets[u]+alphabets[t]+''.join(combo))
        i+=1