Harryxun/stf_run huggingface dataset:
from scipy.sparse.csgraph import dijkstra
from scipy.sparse import csr_matrix
import sys
input = sys.stdin.readline

import heapq

INF = 10 ** 18

class Edge():
    def __init__(self, start, end, cost):
        self.start = start
        self.end = end
        self.cost = cost
    def __str__(self):
        return 'Edge: {} -> {}, cost {}'.format(self.start, self.end, self.cost)

def dijkstra(n, G, s):
    dist = [INF] * n
    dist[s] = 0
    h = []
    heapq.heappush(h, (0, s))

    while h:
        # 使っていない頂点のうち、現時点で最も距離の近いものを選びvとする
        d, v = heapq.heappop(h)
        if dist[v] < d:
            continue
        # vから到達可能な頂点について、距離が短くなれば更新
        for e in G[v]:
            if dist[e.end] > dist[v] + e.cost:
                dist[e.end] = dist[v] + e.cost
                heapq.heappush(h, (dist[e.end], e.end))
    return dist


n = int(input())
es = [[] for i in range(n)]

for i in range(n-1):
    a, b, c = list(map(int, input().split()))
    es[a-1].append(Edge(a-1, b-1, c))
    es[b-1].append(Edge(b-1, a-1, c))

q, k = map(int, input().split())
k -= 1

d = dijkstra(n, es, k)

for j in range(q):
    x, y = map(int, input().split())
    print(d[x-1] + d[y-1])




### FIXED CODE ###

import heapq
import sys
input = sys.stdin.readline

INF = 10 ** 18

class Edge():
    def __init__(self, start, end, cost):
        self.start = start
        self.end = end
        self.cost = cost
    def __str__(self):
        return 'Edge: {} -> {}, cost {}'.format(self.start, self.end, self.cost)

def dijkstra(n, G, s):
    dist = [INF] * n
    dist[s] = 0
    h = []
    heapq.heappush(h, (0, s))

    while h:
        # 使っていない頂点のうち、現時点で最も距離の近いものを選びvとする
        d, v = heapq.heappop(h)
        if dist[v] < d:
            continue
        # vから到達可能な頂点について、距離が短くなれば更新
        for e in G[v]:
            if dist[e.end] > dist[v] + e.cost:
                dist[e.end] = dist[v] + e.cost
                heapq.heappush(h, (dist[e.end], e.end))
    return dist


n = int(input())
es = [[] for i in range(n)]

for i in range(n-1):
    a, b, c = list(map(int, input().split()))
    es[a-1].append(Edge(a-1, b-1, c))
    es[b-1].append(Edge(b-1, a-1, c))

q, k = map(int, input().split())
k -= 1

d = dijkstra(n, es, k)

for j in range(q):
    x, y = map(int, input().split())
    print(d[x-1] + d[y-1])
import sys
from math import sqrt, floor, factorial, gcd
from collections import deque, Counter, defaultdict
inp = sys.stdin.readline
read = lambda: list(map(int, inp().strip().split()))

# def is_prime(n):
# 	for i in range(2, int(sqrt(n))+1):
# 		if n%i == 0:
# 			return(False)
# 	return(True)

# def func(n, arr):
# 	dic = {}
# 	if is_prime(n):
# 		return(arr[-1]+min(func(n, arr)))
# def factorize(n):
# 	output = []
# 	for i in range(2, int(sqrt(n))+1):
# 		if n%i == 0:
# 			c = 0
# 			while n%i == 0:
# 				n //= i
# 				c += 1
# 			output.append((i, c))
# 	if n > 1:
# 		output.append((n, 1))
# 	return(output)
sys.setrecursionlimit(10**6)

def a():
	n = int(inp()); arr = read()
	dic = {0 : 0, 1 : abs(arr[0]-arr[1])}
	def func(arr, n):
		# print(arr[n], n)
		if n in dic:
			return(dic[n])
		min_path = min(abs(arr[n]-arr[n-1])+func(arr,n-1), abs(arr[n]-arr[n-2])+func(arr,n-2))
		dic[n] = min_path
		return(min_path) 


	print(func(arr, n-1))
	# print(dic)




if __name__ == "__main__":
	a()

### FIXED CODE ###

import sys
inp = sys.stdin.readline
read = lambda: list(map(int, inp().strip().split()))


def a():
	n = int(inp()); arr = read()
	dp = [0 for i in range(n)]
	dp[0] = 0
	dp[1] = abs(arr[1]-arr[0])
	for i in range(2, n):
		dp[i] = min(dp[i-1]+abs(arr[i]-arr[i-1]), dp[i-2]+abs(arr[i]-arr[i-2]))
	print(dp[n-1])




if __name__ == "__main__":
	a()
import collections deque
S=deque(input())
T=deque(input())
for i in range(len(T)):
  if S==T:
    print("Yes")
    exit()
  t=T.popleft()
  T.appendleft(t)
print("No")

### FIXED CODE ###

from collections import deque
S=deque(input())
T=deque(input())
for i in range(len(T)):
  if S==T:
    print("Yes")
    exit()
  t=T.pop()
  T.appendleft(t)
print("No")
N, M = map(int,input().split())
A = list(map(int,input().split()))
B = [list(map(int,input().split())) for i in range(M)]

A.sort()
B.sort(reverse = True, key = lambda x: x[1])

cot = 0
add = 0

for b,c in B:
    cot += b
    if cot > N:
        add = N - cot + b
        A.extend([c] * add)
        break
    else:
        A.extend([c] * b)

print(sum(sorted(A, reverse = True))[:N])

### FIXED CODE ###

N, M = map(int,input().split())
A = list(map(int,input().split()))
B = [list(map(int,input().split())) for i in range(M)]

A.sort()
B.sort(reverse = True, key = lambda x: x[1])

cot = 0
add = 0

for b,c in B:
    cot += b
    if cot > N:
        add = N - cot + b
        A.extend([c] * add)
        break
    else:
        A.extend([c] * b)

print(sum(sorted(A, reverse = True)[:N]))
total = 0
for i in range(0, N):
    t = sum(map(int, list(str(i))))
    if A <= t <= B:
        total += t
print (total)

### FIXED CODE ###

N, A, B = map(int, input().split())
total = 0
for n in range(1, N+1):
    tmp = n
    t = 0
    while n > 0:
        t += n%10
        n = n // 10
    if A <= t and t <= B:
        total += tmp
print (total)
while True:
    (m, f, r) = [int(i) for i in input().split()]
    if m==f==r==-1:
        break

    g = m + f
    if m == -1 or f == -1 or g < 30:
        print('F')
    elif g < 50 and r < 50:
        print('D')
    elif g < 65:
        print('C')
    elif g < 80:
        print('B')
    else:
        print('A')
~                    

### FIXED CODE ###

while True:
    (m, f, r) = [int(i) for i in input().split()]
    if m == f == r == -1:
        break
 
    total = m + f
    if m == -1 or f == -1 or total < 30:
        print('F')
    elif total < 50 and r < 50:
        print('D')
    elif total < 65:
        print('C')
    elif total < 80:
        print('B')
    else:
        print('A')
import sys
N,X=(int(x) for x in input().split())
L=[]
L.append(int(y) for y in input().split())
count = 0
D=[0]
for k in range(0,N+1):
  if(D(k)<=6):
    count += 1
  D.append(D(k)+L(k))
  
print(count)
  
  

### FIXED CODE ###

s=list(input().split())
l=list(input().split())
n=int(s[0])
x=int(s[1])
count=1
d=0
for i in range(n):
  d=d+int(l[i])
  if d<=x:
    count+=1
print(count)
import pandas as pd
N = int(input())
city=[]
for n in range(N):
    S = input().split()
    city.append(S)
city=pd.DataFrame(city).sort_values([0,1],ascending=[True, False])

# city=city.sort_index()
for ans in city.index:
    print(ans+1)

### FIXED CODE ###

N = int(input())
city={}
city_name=[]
for n in range(N):
    S = input().split()
    city[n+1]=S
    city_name.append(S[0])

city_name=list(set(city_name))
city_name.sort()

for c_name in city_name:
    city_temp = {}
    for c_key in city.keys():
        if city[c_key][0] == c_name:
            city_temp[int(city[c_key][1])]=c_key
            
    p_temp = list(city_temp.keys())
    p_temp.sort(reverse=True)
    for v in p_temp:
        print(city_temp[v])
H, W, K = map(int, input().split())
C = []
for i in range(H):
    c = str(input())
    C.append(c)
from itertools import combinations
from collections import Counter

def subsets(nums):
    n = len(nums)
    out = []
    for i in range(n+1):
        subout = []
        comb(nums, i, subout)
        out += subout
    return out

def comb(seq, k, out):
    _comb(seq, len(seq), k, 0, [], out)

def _comb(seq, n, k, i, elem, out):
    le = len(elem)
    if le == k:
        out.append(elem)
        return
    for i in range(i, n):
        _comb(seq, n, k, i+1, elem + [seq[i]], out)

def powset(H, W, K, C):
    X = subsets(list(range(W)))
    N = len(X)
    A = []
    for j in range(H):
        a = [0]*N
        for k in range(N):
            for ind in X[k]:
                if C[j][ind] == '#':
                    a[k] += 1
        A.append(a)
    Y = subsets(list(range(H)))
    M = len(Y)
    ans = [0]*(N*M)
    for k in range(N):
        for l in range(M):
            for ind in Y[l]:
                ans[l*M+k] += A[ind][k]
            
    c = Counter(ans)
    if K not in C:
        return 0
    else:
        return c[K]
        

def Main(H, W, K, C):
    return powset(H, W, K, C)
                    
out = Main(H, W, K, C)
print(out)

### FIXED CODE ###

H, W, K = map(int, input().split())
C = []
for i in range(H):
    c = str(input())
    C.append(c)
from itertools import combinations
from collections import Counter

def subsets(nums):
    n = len(nums)
    out = []
    for i in range(n+1):
        subout = []
        comb(nums, i, subout)
        out += subout
    return out

def comb(seq, k, out):
    _comb(seq, len(seq), k, 0, [], out)

def _comb(seq, n, k, i, elem, out):
    le = len(elem)
    if le == k:
        out.append(elem)
        return
    for i in range(i, n):
        _comb(seq, n, k, i+1, elem + [seq[i]], out)

def powset(H, W, K, C):
    X = subsets(list(range(W)))
    N = len(X)
    A = []
    for j in range(H):
        a = [0]*N
        for k in range(N):
            for ind in X[k]:
                if C[j][ind] == '#':
                    a[k] += 1
        A.append(a)
    Y = subsets(list(range(H)))
    M = len(Y)
    ans = [0]*(N*M)
    for k in range(N):
        for l in range(M):
            for ind in Y[l]:
                ans[l*N+k] += A[ind][k]
            
    c = Counter(ans)
#     print(c)
    if K in c:
        return c[K]
    else:
        return 0
        

def Main(H, W, K, C):
    return powset(H, W, K, C)
                    
out = Main(H, W, K, C)
print(out)
a = [list(map(int,input().split())) for i in range(n)]
b = set()
for i in range(n):
    a[i].pop(0)
b = set(a[0])
for i in range(n):
    c = set(a[i])
    b = b&c
print(len(list(b)))

### FIXED CODE ###

n,m = map(int ,input().split())
a = [list(map(int,input().split())) for i in range(n)]
b = set()
for i in range(n):
    a[i].pop(0)
b = set(a[0])
for i in range(n):
    c = set(a[i])
    b = b&c
print(len(list(b)))
N = int(input())
S,T = list(map(str,input().split()))
ans = []*N 
for i in range(N):
  ans[i] = S[i] + T[i]
  i += 1
print(sum(ans))

### FIXED CODE ###

N = int(input())
S,T = list(map(str,input().split()))
list_ans = []
for i in range(N):
  list_ans.extend(S[i] + T[i])
  i += 1
ans = ''.join(list_ans)
print(ans)
N, C = map(int, input().split())
table = [[0]*(10**5 + 1) for i in range(C)]

st = [[] for i in range(C)]
for i in range(N):
  s, t, c = map(int, input().split())
  st[c-1].append([s, t])

st_new = [[] for i in range(C)]
for c in range(C):
  if st[c]:
    st[c].sort()
    st_new[c].append(st[c][0])
    n = len(st[c])
    for i in range(1, n):
      si, ti = st[c][i]
      sii, tii = st_new[c][-1]
      if si == tii:
        st_new[c][i-1][1] = ti
      else:
        st_new[c].append([si, ti])

for c in range(C):
  for s, t in st_new[c]:
    table[c][s-1] += 1
    table[c][t] -= 1
  
for c in range(C):
  for i in range(1, 10**5+1):
    table[c][i] += table[c][i-1]

ans = 0
for i in range(10**5 + 1):
  num = 0
  for c in range(C):
    num += table[c][i]
  ans = max(ans, num)

print(ans)

### FIXED CODE ###

N, C = map(int, input().split())
table = [[0]*(10**5 + 1) for i in range(C)]

st = [[] for i in range(C)]
for i in range(N):
  s, t, c = map(int, input().split())
  st[c-1].append([s, t])

st_new = [[] for i in range(C)]
for c in range(C):
  if st[c]:
    st[c].sort()
    st_new[c].append(st[c][0])
    n = len(st[c])
    for i in range(1, n):
      si, ti = st[c][i]
      sii, tii = st_new[c][-1]
      if si == tii:
        st_new[c][-1][1] = ti
      else:
        st_new[c].append([si, ti])

for c in range(C):
  for s, t in st_new[c]:
    table[c][s-1] += 1
    table[c][t] -= 1
  
for c in range(C):
  for i in range(1, 10**5+1):
    table[c][i] += table[c][i-1]

ans = 0
for i in range(10**5 + 1):
  num = 0
  for c in range(C):
    num += table[c][i]
  ans = max(ans, num)

print(ans)
# -*- coding: utf-8 -*-
N = int(input())
a = [input() for i in range(N)]
S = max(a) // 2
a.remove(max(a)) #aの最大の要素を消去
print(sum(a,S)) #処理後のリストaにSを加えて足す

### FIXED CODE ###

# -*- coding: utf-8 -*-
N = int(input())
a = [int(input()) for i in range(N)]
s = int(max(a)) // 2
a.remove(max(a)) #aの最大の要素を消去
print(sum(a) + s) #処理後のリストaにSを加えて足す
import math
N, K = map(int,input().split())
A = [int(i) for i in input().split()]

if K == 0:
    print(max(A))
else:
    low = 0
    high = max(A)
    while high - low > 0.5:
        mid = (low + high) / 2
        times = 0
        for a in A:
            times += math.ceil(a / mid) - 1
        if K >= times:
            high = mid
        else:
            low = mid
        #print(mid)

    ans = int(mid)
    times = 0
    for a in A:
        times += math.ceil(a / ans) - 1
    if times <= K:
        print(ans)
    else:
        print(ans+1)


### FIXED CODE ###

import math
N, K = map(int,input().split())
A = [int(i) for i in input().split()]

if K == 0:
    print(max(A))
else:
    low = 0
    high = max(A)
    while high - low > 0.1:
        mid = (low + high) / 2
        times = 0
        for a in A:
            times += math.ceil(a / mid) - 1
        if K >= times:
            high = mid
        else:
            low = mid
        #print(mid)

    ans = int(mid)
    if not ans:
        print(1)
    else:
        times = 0
        for a in A:
            times += math.ceil(a / ans) - 1
        if times <= K:
            print(ans)
        else:
            print(ans+1)
A,B=map(int,input().split())
a,b=map(int,input().split())

A-a=m
B-b=n

print(int(m*n))

### FIXED CODE ###

A,B=map(int,input().split())
a,b=map(int,input().split())

x=A-a
y=B-b

print(int(x*y))
k = int(input())
a,b = map(int,input().split())
for i in range(a,b+1):
    if i%k == 0:
        han = True
if han == True:
    print("OK")
else:
    print("NG")

### FIXED CODE ###

k = int(input())
a,b = map(int,input().split())
han = False
for i in range(a,b+1):
    if i%k == 0:
        han = True
if han == True:
    print("OK")
else:
    print("NG")
N, K = map(int, input().split())
S = input()

if (S[K] == 'A'):
  S[K] = 'a'
elif (S[K] == 'B'):
  S[K] = 'b'
else:
  S[K] = 'c'
    
printf(S)



### FIXED CODE ###

N, K = map(int, input().split())
S = list(str(input()))

if (S[K-1] == 'A'):
  S[K-1] = 'a'
elif (S[K-1] == 'B'):
  S[K-1] = 'b'
elif (S[K-1] == 'C'):
  S[K-1] = 'c'
  
ans = ''.join(S)
    
print(ans)
def Qb():
    from functools import reduce
    from operator import mul

    n = int(input())
    lina = map(int, input().split())

    if 0 in lina:
        print(0)
        exit()

    ans = reduce(mul, lina)

    if 10 ** 18 < ans:
        ans = -1
    print(ans)


def Qc():
    pass


if __name__ == '__main__':
    Qb()


### FIXED CODE ###

def Qb():
    n = int(input())
    lina = list(map(int, input().split()))

    if 0 in lina:
        print(0)
        exit()

    ans = 1
    for a in lina:
        ans *= a
        if 10 ** 18 < ans:
            ans = -1
            break
    print(ans)

if __name__ == '__main__':
    Qb()
n,m = map(int, input().split())
a = []
for i in range(m):
    a.append(int(input()))

if a[0] == 1:
    x = [1,0]
else:
    x = [1,1]

for i in range(2,n+1):
    if i in a:
        x.append(0)

    else:
        x.append(x[i-1] + x[i-2])

if x[-1] == 0:
    print(0)
else:
    print(x[-1]%1000000007)

### FIXED CODE ###

n,m = map(int, input().split())
a = [True]*(n+1)
for i in range(m):
    t = int(input())
    a[t] = False

x = [0]*(n+1)
x[0] = 1
if a[1]:
    x[1] = 1


for i in range(2, n+1):
    if a[i]:
        x[i] = x[i-1]+ x[i-2]
print(x[n]%1000000007)
N=int(input())
A=[]
g=[[-1]*(N) for i in range(N)]#g[i][j]はi番目からのj番目に対する証言

for i in range(N):
    a=int(input())
    A.append(a)
    for j in range(a):
        x,y=map(int,input().split())
        x-=1
        g[i][x]=y
num=[]
for i in range(2 **N):
  chars = list(f"{i:0{N}b}")
  chars=list(map(int,chars))
  num.append(chars)


ans=[]
for x in num:
    ok = True
    for k in range(N):#k番目の人
        if x[k]:
            for j in range(N):
                if g[k][j]==-1:
                    continue
                elif g[k][j]!=x[j]:
                    ok=False
    if ok:
        ans.append(x.count(1))
print(max(ans))

### FIXED CODE ###

N=int(input())
A=[]
g=[[-1]*(N) for i in range(N)]#g[i][j]はi番目からのj番目に対する証言

for i in range(N):
    a=int(input())
    A.append(a)
    for j in range(a):
        x,y=map(int,input().split())
        x-=1
        g[i][x]=y
""""
num=[]
for i in range(2 **N):
  chars = list(f"{i:0{N}b}")
  chars=list(map(int,chars))
  num.append(chars)
"""
num=[]
for i in range(2**N):
    x=[]
    for j in range(N):
        if i>>j & 1:
            x.append(1)
        else:
            x.append(0)
    num.append(x)

ans=[]
for x in num:
    ok = True
    for k in range(N):#k番目の人
        if x[k]:
            for j in range(N):
                if g[k][j]==-1:
                    continue
                elif g[k][j]!=x[j]:
                    ok=False
    if ok:
        ans.append(x.count(1))
print(max(ans))
from collections import deque

def dfs():
    global color
    global edge
    color = [-1] * n
    edge = [[] for _ in range(n)]

    q = deque([])
    q.append(0)
    color[0] = 1
    
    while q:
        p = q.pop()
        for u in edge[p]:
            if color[u] == -1:
                color[u] = (color[p] + 1) % 2
                q.append(u)
            else:
                if color[u] == color[p]:
                    return False
    return True

n, m = map(int, input().split())

for i in range(m):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    edge[a].append(b)
    edge[b].append(a)


if dfs():
    B = 0
    W = 0
    for i in range(n):
        if color[i] == 1:
            B += 1
        else:
            W += 1
    print(B*W - m)
else:
    print(n * (n-1) // 2 - m)

### FIXED CODE ###

from collections import deque

def dfs():
    global color
    color = [-1] * n
    q = deque([])
    q.append(0)
    color[0] = 1
    
    while q:
        p = q.pop()
        for u in edge[p]:
            if color[u] == -1:
                color[u] = (color[p] + 1) % 2
                q.append(u)
            else:
                if color[u] == color[p]:
                    return False
    return True

n, m = map(int, input().split())
edge = [[] for _ in range(n)]

for i in range(m):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    edge[a].append(b)
    edge[b].append(a)


if dfs():
    B = 0
    W = 0
    for i in range(n):
        if color[i] == 1:
            B += 1
        else:
            W += 1
    print(B*W - m)
else:
    print(n * (n-1) // 2 - m)
n,k=map(int,input().split())

now = 0
a = [_-1 for _ in list(map(int,input().split()))]

past = []
offset = 0
cnt = 0
idx = 0
fl = False
for i in range(k):
  if fl:
    break
  past.append(now)
  now = a[now]
  try:
    idx = past.index(now)
    cnt = i-idx+1
    fl = True
    break
  except:
    pass

now = 0
for i in range(k % cnt):
  now = a[now]

print(offset + now+1)

### FIXED CODE ###

n,k=map(int,input().split())

now = 0
a=list(map(int,input().split()))

s = []
od = [-1]*(n+1)
c=1
l=0

v=1

while od[v] == -1:
  od[v] = len(s)
  s.append(v)
  v = a[v-1]

c=len(s)-od[v]
l=od[v]

if k<l:
  print(s[k])
else:
  k-=l
  k%=c
  print(s[l+k])
# -*- coding: utf-8 -*-
# 文字列の入力
a = input()

if (a.count("a") + a.count("b") + a.count("c") ) == 3):
    print("Yes")
# 出力
else:
    print("No")

### FIXED CODE ###

# -*- coding: utf-8 -*-
# 文字列の入力
a = input()

if (a.count("a") and a.count("b") and a.count("c") ):
    print("Yes")
# 出力
else:
    print("No")
def factorial(number):
	if number>2:
		return number*factorial(number-1)
	elif not number==0:
		return number
	else:
		return 1
def choose2(number):
	if number>=2:
		return number*(number-1)/2
	else:
		return 0
N = int(input())
klist = input()
k = []
for x in range(N-1):
	k.append(int(klist[:klist.index(" ")]))
	klist = klist[klist.index(" ")+1:]
k.append(int(klist))
valArr = list(set(k))
occurence = []
for i in range(len(valArr)):
	occurence.append(0)
for j in range(N):
	for x in range(len(valArr)):
		if k[j]==valArr[x]:
			occurence[x]+=1
for ball in range(len(k)):
	ans = 0
	kArray = occurence[:len(occurence)]
	for index in range(len(valArr)):
		if valArr[index]==k[ball]:
			kArray[index]-=1
			break;
	for time in kArray:
		ans+=choose2(time)
	print(int(ans))


### FIXED CODE ###

#Contest 159
x = input()
N = int(x[:x.index(" ")])
M = int(x[x.index(" ")+1:])
def factorial(number):
	if number>2:
		return number*factorial(number-1)
	elif not number==0:
		return number
	else:
		return 1
def choose2(number):
	if number>=2:
		return factorial(number)/(2*factorial(number-2))
	else:
		return 0

print(int(choose2(N)+choose2(M)))
import franctions
a, b = map(int, input().split())

def lcm(a,b):
    return (a*b)//franctions.gcd(a,b)

print(lcm(a,b))

### FIXED CODE ###

import fractions
a, b = map(int, input().split())

def lcm(a,b):
    return (a*b)//fractions.gcd(a,b)

print(lcm(a,b))
a=int(input())
b=int(input())
if(a>8 or b>8):print(":(")
else:print("Yay!")

### FIXED CODE ###

a,b=map(int,input().split())
if(a>8 or b>8):print(":(")
else:print("Yay!")
s = input()

a = ['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']

for c in s:
    if c in a:
        a.remove(c)

print(a[0])

### FIXED CODE ###

s = input()

a = ['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']

for c in s:
    if c in a:
        a.remove(c)
if len(a) > 0:
    print(a[0])
else:
    print("None")
# coding: utf-8
# Your code here!

num = int(input())

qm = 1000000000000001

alf = [chr(i) for i in range(97, 97+26)]
#print(alf)

ans = []
f = False

for i in reversed(range(12)):
    if (num-i*26)//26**i >= 1:
        f = True
    if f:
#            print((num-i)//26**i)
        ans.append(alf[(num-i)//26**i-1])
        num = num % 26**i
print("".join(ans))



### FIXED CODE ###

# coding: utf-8
# Your code here!

num = int(input())

qm = 1000000000000001

alf = [chr(i) for i in range(97, 97+26)]
#print(alf)

ans = []
f = False

for i in range(12):
    c = (num-1) % 26
    ans += alf[c]
    num = (num-1) // 26
    if num < 1:
        break

print("".join(reversed(ans)))
n = input()
s,t = input().split()

out = ""

for i in range(2):
    out += s[i]
    out += t[i]

print(out)

### FIXED CODE ###

n = int(input())
s,t = input().split()

# n = int(2)
# s,t = "ip cc".split()

out = ""

for i in range(n):
    out += s[i]
    out += t[i]

print(out)
N = int(input())
S = list(input())

sumx = 0
for i in range(N-2):
    if S[i] != S[i + 1]:
        sumx += 1

if S[-2] != S[-1]:
    sumx += 2
elif S[-2] == S[-1]:
    sumx += 1

print(sumx)


### FIXED CODE ###

N = int(input())
S = list(input())

sumx = 0
mem = ""

for i in S:
    if i != mem:
        sumx += 1
        mem = i
    else:
        mem = i

print(sumx)