Harryxun/stf_run huggingface dataset:
from sys import setrecursionlimit

def Search(n):
  L[n-1] = 1
  for i in R[n]:
    if L[i-1] == 0:
      Search(i)

setrecursionlimit(200000)
N, M = map(int, input().split())
L = [1] * N
R = {}
ans = -1
for i in range(M):
  A, B = map(int, input().split())
  if A not in R:
    R[A] = set()
  if B not in R:
    R[B] = set()
  R[A].add(B)
  R[B].add(A)
  L[A-1] = 0
  L[B-1] = 0
for i in range(N):
  if L[i] == 1:
    ans += 1
    R[i+1] = set()
    if i == 0:
      R[i+1].add(2)
      R[2].add(i+1)
    else:
      R[i+1].add(1)
      R[1].add(i+1)
    L[i] = 0
while sum(L) != N:
  ans += 1
  Search(L.index(0) + 1)
print(ans)

### FIXED CODE ###

N, M = map(int, input().split())
L = [0] * N
D = {}
c = 1
for i in range(M):
  A, B = map(int, input().split())
  if L[A - 1] == L[B - 1] == 0:
    D[c] = set()
    D[c].add(A)
    D[c].add(B)
    L[A - 1] = c
    L[B - 1] = c
    c += 1
  elif L[A - 1] == 0:
    D[L[B - 1]].add(A)
    L[A - 1] = L[B - 1]
  elif L[B - 1] == 0:
    D[L[A - 1]].add(B)
    L[B - 1] = L[A - 1]
  elif L[A - 1] != L[B - 1]:
    if len(D[L[A - 1]]) < len(D[L[B - 1]]):
      A, B = B, A
    D[L[A - 1]] |= D[L[B - 1]]
    for j in D.pop(L[B - 1]):
      L[j - 1] = L[A - 1]
  #print(L, D, sep = "\n")
print(len(D) + L.count(0) - 1)
n = int(input())
a = list(map(int, input().split()))
i = max(a)
a.remove(i)
k = min(a, key=lambda x: abs(i-x*2))
print(i, j)

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
i = max(a)
a.remove(i)
j = min(a, key=lambda x: abs(i/2-x))
print(i, j)
isExist = [0]*2001 
n = int( input() )
d = int( input() )
for i in range( 0, d ):
	print( "yes" )

### FIXED CODE ###

def solve( p, t ):
	global isExist, n, A
	isExist[ t ] = True
	if p < n:
		solve( p+1, t-A[p] )
		solve( p+1, t )
	else:
		return

isExist = [False]*2001 
n = int( input() )
A = [ int( val ) for val in input().rstrip().split( ' ' ) ]
q = int( input() )
M = [ int( val ) for val in input().rstrip().split( ' ' ) ]
s = sum( A )
solve( 0, s )
for i in range( 0, q ):
	if isExist[ M[i] ]:
		print( "yes" )
	else:
		print( "no" )
N, *A = map(int, open(0).read().split())
n = N//3 + (1 if N % 3 == 0 else 2)
cur_i = []

for i in range(n):
    a = A[i]
    b = A[i+1]
    c = A[i+2]

    if a < 0 and b < 0 and c < 0:
        if A[i-1] * -1 > A[i+3] * -1:
            cur_i.append(i-1)
        else:
            cur_i.append(i+3)

ans = 0
for i, a in enumerate(A):
    if i in cur_i:
        ans += a * -1
    else:
        ans += abs(a)

print(ans)


### FIXED CODE ###

N, *A = map(int, open(0).read().split())
negative_num = sum(1 if a < 0 else 0 for a in A)
positive_num = list(abs(n) for n in A)

if negative_num % 2 == 0:
    print(sum(positive_num))
else:
    print(sum(positive_num) - 2*min(positive_num))
from sys import exit
from itertools import accumulate,chain
n,*s=open(0).read().split()
t=[2*i.count("(")-len(i) for i in s]
if sum(t)!=0:
    print("No");exit()
st=[[min(accumulate(s_,lambda a,b: a+(1 if b=="(" else -1),initial=0)),t_] for s_,t_ in zip(s,t)]
now=0
for c in chain(sorted([x if x[1]>=0 for x in st])[::-1],sorted([x if x[1]<0 for x in st],lambda z:z[1]-z[0])[::-1]):
    if now+c[0]<0:
        print("No");exit()
    now+=c[1]
print("Yes")

### FIXED CODE ###

import sys
n=int(input())
s=[input() for i in range(n)]
t=[2*(i.count("("))-len(i) for i in s]
if sum(t)!=0:
    print("No")
    sys.exit()
st=[[t[i]] for i in range(n)]

for i in range(n):
    now,mi=0,0
    for j in s[i]:
        if j=="(":
            now+=1
        else:
            now-=1
        mi=min(mi,now)
    st[i].append(mi)
#st.sort(reverse=True,key=lambda z:z[1])
u,v,w=list(filter(lambda x:x[1]>=0,st)),list(filter(lambda x:x[1]<0 and x[0]>=0,st)),list(filter(lambda x:x[1]<0 and x[0]<0,st))
v.sort(reverse=True)
v.sort(reverse=True,key=lambda z:z[1])
w.sort(key=lambda z:z[0]-z[1],reverse=True)
lu=len(u)
lv=len(v)
now2=0
for i in range(n):
    if i<lu:
        now2+=u[i][0]
    elif i<lu+lv:
        if now2+v[i-lu][1]<0:
            print("No")
            break
        now2+=v[i-lu][0]
    else:
        #いや、間違ってるのここなんかーーい
        if now2+w[i-lu-lv][1]<0:
            print("No")
            break
        now2+=w[i-lu-lv][0]
else:
    print("Yes")
import sys
N = input()
vals = map(int, input().split())
result = sys.maxint
for i in xrange(N):
    val = vals[i]
    count = 0
    while True:
        if val % 2 == 1:
            break
        val /= 2
        count += 1
    if result > count:
        result = count
print (result)

### FIXED CODE ###

N = int(input())
vals = list(map(int, input().split()))
count = 0
is_odd = False
while True:
    for i in range(0, N):
        if vals[i] % 2 == 1:
            is_odd = True
        vals[i] /= 2
    if is_odd:
        break
    count += 1
print (count)
count = int(input())
    result = 0
    for i in range(count+1):
        print(i)
        result += i

    print(result

### FIXED CODE ###

def iroha():
    count = int(input())
    result = 0
    for i in range(count+1):
        result += i

    print(result)


if __name__ == "__main__":
    iroha()
import sys
input = sys.stdin.readline
 
N,M = list(map(int,input().split()))
A = [int(input()) for _ in range(M)]
 
a2 = 1
a1 = 0 if 1 in A else 1
i = 1
def stair(stepb2,stepb1):
    global i
    i+=1
    step = stepb2 + stepb1
    
    if i in A:
        step = 0
    if i == N:
        print(step%1000000007)
        return step
    else:
        stair(stepb1,step)
if N == 1:
    print(a1)
else:
    _ = stair(a2,a1)

### FIXED CODE ###

n,m = map(int,input().split())
a = [ int(input()) for _ in range(m)]
M=10**9+7
lis = [1] + [0]*n

for i in a:
  lis[i]=-1
lis[1] += 1
for i in range(n-1):
  if lis[i+2]<0:
    lis[i+2]= 0
  else:
    lis[i+2] = (lis[i+1] + lis[i])%M
print(lis[n])
from collections import Counter
a,b,c = map(int,input().split())
d = ""
e = ("1"*b + "0"*c)*a
f = d[:a]
g = Counter(f)
print(g["1"])


### FIXED CODE ###

a,b,c = map(int,(input().split()))
d = (a//(b+c))*b + min((a%(b+c)),b)
print(d)
import sys
n,y=map(int,input().split())
if n*10000<y:
    print("-1 -1 -1")
    sys.exit()
if y//1000<n:
    print("-1 -1 -1")
    sys.exit()
m=y//10000
g=(y-m*10000)//5000
k=(y-10000*i-5000*j)//1000
for i in range(m+1):
    for j in range(g+1):
        for s in range(k+1):
            s=(y-10000*i-5000*j)//1000
            if i+j+s==n and s>=0:
                print(i,j,s)
                sys.exit()
print("-1 -1 -1")

### FIXED CODE ###

import sys
n,y=map(int,input().split())
if n*10000<y:
    print("-1 -1 -1")
    sys.exit()
if y//1000<n:
    print("-1 -1 -1")
    sys.exit()
m=y//10000
for i in range(m+1):
    g=(y-i*10000)//5000
    for j in range(g+1):
        s=(y-10000*i-5000*j)//1000
        if i+j+s==n and s>=0:
            print(i,j,s)
            sys.exit()
print("-1 -1 -1")
import time
import random
import math
def sigmoid(x):
  return 1/(1+math.exp(-x))
def score(a,c,s,d):
  l=[-1 for i in range(26)]
  r=0
  for i in range(d):
    l[a[i]]=i
    r+=s[i][a[i]]
    for j in range(26):
      r-=c[j]*(i-l[j])
  return r
  
st=time.time()
d=int(input())
c=list(map(int,input().split()))
s=[]
for i in range(d):
  s.append(list(map(int,input().split())))

ans=[]
l=[-1 for i in range(26)]
ld=[]
for i in range(d):
  ms=-10**9
  mt=None
  for j in range(26):
    js=c[j]*(i-l[j])+s[i][j]
    if ms<js:
      ms=js
      mt=j
  l[mt]=i
  ans.append(mt)
  ld.append([l[mt],d])
  if l[mt]>=0:
    ld[l[mt]][1]=i

os=score(ans,c,s,d)
nt=st
rate=200
while nt-st<1.50:
  nt=time.time()
  na=[ans[i] for i in range(d)]
  na[random.randint(1,d-1)]=random.randint(0,25)
  ns=score(na,c,s,d)
  if sigmoid((ns-os)/rate/((2-nt+st)**2)-0.5)>random.random():
    os=ns
    ans=na
  
  


for i in ans:
  print(i+1)

### FIXED CODE ###

d=int(input())
c=list(map(int,input().split()))
s=[]
for i in range(d):
  s.append(list(map(int,input().split())))

ans=[]
l=[-1 for i in range(26)]
for i in range(d):
  ms=-10**9
  mt=None
  for j in range(26):
    js=c[j]*(i-l[j])+s[i][j]
    if ms<js:
      ms=js
      mt=j
  l[mt]=i
  ans.append(mt)

for i in ans:
  print(i+1)
s=input()
s[3]='8'
print(s)

### FIXED CODE ###

s=input()
s=s.replace('2017','2018')
print(s)
n, k = map(int, input().split())
a = list(map(int, input().split()))

a.sort(reverse=True, key=lambda x:abs(x))
cnt = 0
im = -1
ip = -1
cp = 0
mod = 10 ** 9 + 7
nm = 0
np = 0

for i, ai in enumerate(a):
    if i < k:
        if ai < 0:
            im = i
            cnt += 1
        if ai > 0:
            ip = i
    else:
        if ai < 0 and nm == 0:
            nm = ai
        if ai > 0 and np == 0:
            np = ai
    if ai > 0:
        cp += 1

ans = 1
f = 0

# print(a)
if cnt % 2 and k < n:
    if cp == 0:
        a.sort(reverse=True)
        for i, ai in enumerate(a):
            if i == k:
                break
            ans *= ai
            ans %= mod
        print(ans) # ok
    else:
        ans = 1
        cnt = 0
        f1 = 0
        f2 = 0
        for i, ai in enumerate(a):
            if cnt == k - 2:
                break
            if i == im:
                f1 = 1
                continue
            if i == ip:
                f2 = 1
                continue
            if f1 and ai <= 0:
                continue
            if f2 and ai >= 0:
                continue
            ans *= abs(ai)
            ans %= mod
            # print(i, ai)
            cnt += 1
        ans *= max(a[ip] * np, a[im] * nm)
        ans %= mod
        print(1/0)
else:
    for i, ai in enumerate(a):
        if i == k:
            break
        ans *= abs(ai)
        ans %= mod
    print(ans) # ok



### FIXED CODE ###

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

a.sort(reverse=True, key=lambda x:abs(x))
cnt = 0
im = -1
ip = -1
cp = 0
mod = 10 ** 9 + 7
nm = 0
np = 0

for i, ai in enumerate(a):
    if i < k:
        if ai < 0:
            im = i
            cnt += 1
        if ai > 0:
            ip = i
    else:
        if ai < 0 and nm == 0:
            nm = ai
        if ai > 0 and np == 0:
            np = ai
    if ai > 0:
        cp += 1

ans = 1
f = 0

# print(a)
if cnt % 2 and k < n:
    if cp == 0:
        a.sort(reverse=True)
        for i, ai in enumerate(a):
            if i == k:
                break
            ans *= ai
            ans %= mod
        print(ans) # ok
    else:
        cnt = 0
        f1 = 0
        f2 = 0
        for i, ai in enumerate(a):
            if f1 + f2 + cnt == k:
                break 
            if i == im:
                f1 = 1
                continue
            if i == ip:
                f2 = 1
                continue
            if f1 and ai <= 0:
                continue
            if f2 and ai >= 0:
                continue
            ans *= ai
            ans %= mod
            cnt += 1
        if ip == -1:
            ans *= np
        else:
            ans *= max(a[ip] * np, a[im] * nm)
        ans %= mod
        print(ans) # ng
        # - + - - / + -
else:
    for i, ai in enumerate(a):
        if i == k:
            break
        ans *= ai
        ans %= mod
    print(ans) # ok
A, B, K =map(int, input().split())
tmp = []
for i in range(2,min(A,B)+1):
    if A%i == 0 and B%i == 0:
        emp.append(i)
tmp.sort(reverse=True)
print(tmp[K-1])

### FIXED CODE ###

A, B, K =map(int, input().split())
tmp = []
try:
    for i in range(2,min(A,B)+1):
        if A%i == 0 and B%i == 0:
            tmp.append(i)
    tmp.sort(reverse=True)
    print(tmp[K-1])
except:
    print(1)
n=int(input())
data=[int(aa) for aa in input().split()]
d=[0 for aa in range(100000+1)]
for aa in data:
    d[aa]+=1
#print(d)
mydata=0
mylist=[0,0]
for aa in range(100000+1):
    if d[aa] >3:
        mydata=aa
    if d[aa] >1 :
        if aa not in mylist:
            mylist.pop(0)
            mylist.append(aa)
#            print(mylist)

print(max(mydata*mydata,mylist[0]*mylist[1]))


### FIXED CODE ###

from collections import Counter
n=int(input())
data=[int(aa) for aa in input().split()]

dct=Counter(data)
dct=dct.items()

dct2=[item for item in dct if item[1] > 1]
dct2.sort(reverse=True)

dct4=[item for item in dct if item[1] > 3]
dct4.sort(reverse=True)

ans=0
if len(dct2) > 1:
  ans=dct2[0][0]*dct2[1][0]
if len(dct4) > 0: 
  ans=max(ans,dct4[0][0]*dct4[0][0])

print(ans)
N = int(input())
A = int(input())
B = int(input())

print('Hello World') if N == 1 else print(A+B)


### FIXED CODE ###

if int(input()) == 1:
    print('Hello World')
else:
    A = int(input())
    B = int(input())
    print(A+B)
N, M = map(int, input().split())

cities = {}
output = []
for i in range(M):
    x, y = map(int, input().split())
    cities[i+1] = [x,y]
    output.append(y)

ID = {}
county_old = 0
sorted_counties_years = sorted(cities.values())
for county,year in sorted_counties_years:
    if county_old == 0:
        county_old = county
        count = 1
        ID[year] = f'{county:06}{count:06}'
        count += 1
        continue
    elif county_old == county:
        ID[year] = f'{county:06}{count:06}'
        count += 1
    else:
        county_old = county
        count = 1
        ID[year] = f'{county:06}{count:06}'
        count += 1
for i in output:
    print(ID[i])

### FIXED CODE ###

N, M = map(int, input().split())

cities = {}
output = []
for i in range(M):
    x, y = map(int, input().split())
    cities[i+1] = [x,y]
    output.append(y)

ID = {}
county_old = 0
sorted_counties_years = sorted(cities.values())
for county,year in sorted_counties_years:
    if county_old == 0:
        county_old = county
        count = 1
        ID[year] = '{:06}{:06}'.format(county, count)
        count += 1
        continue
    elif county_old == county:
        ID[year] = '{:06}{:06}'.format(county, count)
        count += 1
    else:
        county_old = county
        count = 1
        ID[year] = '{:06}{:06}'.format(county, count)
        count += 1
for i in output:
    print(ID[i])
import sys
x = int(input())
if (x == 1000):
    print(1000)
    sys.exit()
list = []
list.append(1)
for i in range(30):
    tmp = (i+2)**2
    while (tmp <= 1000):
        list.append(tmp)
        tmp = tmp*(i+2)
list.sort()
tmp = list[0]
for i in list:
    if (i > x):
        print(tmp)
        sys.exit()
    tmp = i


### FIXED CODE ###

import sys
import math
a, b, c, d = map(int, input().split())
if (max(a, c) - min(a, c) <= d or (max(a, b) - min(a, b) <= d and max(c, b) - min(c, b) <= d)):
    print('Yes')
else:
    print('No')
v=int(input())
while v<=10:
    v=v%10
if v=3:
    print("bon")
elif v%2==1:
    print("pon")
else:
    print("hon")


### FIXED CODE ###

v=int(input())

v=v%10
if v==3:
    print("bon")
elif v==0 or v==1 or v==6 or v==8:
    print("pon")
else:
    print("hon")
x1,y1,x2,y2 = map(int,int(input().split())
h = max(abs(x2-x1),abs(y2-y1))
v = min(abs(x2-x1),abs(y2-y1))
if x1 > x2:
  if y1 > y2: print(x2+h,y2-v,x1+h,y1-v)
  else:print(x2-v,y2-h,x1-v,y1-h)
else:
  if y1 > y2: print(x2+v,y2+h,x1+v,y1+h)
  else:print(x2-h,y2+v,x1-h,y1+v)

### FIXED CODE ###

x1,y1,x2,y2 = map(int,input().split())
h = abs(x2-x1)
v = abs(y2-y1)
if x1 > x2:
  if y1 > y2: print(x2+v,y2-h,x1+v,y1-h)
  else:         print(x2-v,y2-h,x1-v,y1-h)
else:
  if y2 > y1: print(x2-v,y2+h,x1-v,y1+h)
  else:         print(x2+v,y2+h,x1+v,y1+h)
S = input()
if S = 'SSS':
  print('0')
elif S = 'RRR':
  print('3')
elif S = 'RRS' or S = 'SRR':
  print('2')
else :
  print('1')
  

### FIXED CODE ###

S = input()
if S =='SSS':
  print('0')
elif S == 'RRR':
  print('3')
elif S == 'RRS' or S == 'SRR':
  print('2')
else :
  print('1')
n = int(input())
S = input()
x, y, c = 0, S.count('.'), min(n-y, y)
for i in range(n):
  t = S[i]=='#'
  x += t
  y -= 1-t
  c = min(c, x+y)
print(c)

### FIXED CODE ###

_ = input()
S = input().lstrip('.').rstrip('#')
n = len(S)
A = list(S)

x = 0
y = S.count('.')
ans = min(n-y, y)
for i in range(n):
  if S[i] == '#':
    x += 1
  else:
    y -= 1
  ans = min(ans, x + y)
print(ans)
"""
python3 main.py < input.txt
"""
import math
import itertools as it
import heapq
"""
A,B,T=map(int, input().split())
print(int(math.floor((T+0.5)/(A))*B))
"""
"""
N=int(input())
V=list(map(int, input().split()))
C=list(map(int, input().split()))
print(sum([V[i] - C[i] for i in range(N) if V[i] - C[i] > 0]))
"""

N=int(input())
A=list(enumerate(map(int, input().split())))

if len(A) == 2:
        print(max(A[0][1], A[1][1]))
        exit()

maxX=-1
for i, ai in enumerate(A):
        x=10**20
        l=list(A)
        l0, l1=(l[1][1], l[2][1]) if i == 0 else (l[0][1], l[2][1]) if i == 1 else (l[0][1], l[1][1]) 

        x=math.gcd(l0, l1)
        for (j, lj) in l[3:]:
                if i != j:
                        x=math.gcd(x, lj)
        maxX=max(x, maxX)
print(maxX)
"""
N=int(input())
A=list(map(int, input().split()))
nNeg = len([1 for a in A if a < 0])
minAbs = min(A, key=lambda ai: abs(ai))
if nNeg%2 == 0:
        print(sum([abs(ai) for ai in A]))
else:
        print(-2*abs(minAbs) + sum([abs(ai) for ai in A]))
"""

### FIXED CODE ###

"""
python3 main.py < input.txt
"""
import math
import itertools as it
import heapq

def gcd(a, b):
        return a if b == 0 else gcd(b, a%b)
N=int(input())
A=list(map(int, input().split()))

L=[A[0]]
for i in range(1, N):
        L.append(gcd(L[-1], A[i]))
R=[A[-1]]
for i in reversed(range(N-1)):
        R.append(gcd(R[-1], A[i]))
R.reverse()

m=max(R[1], L[-2])
for i in range(1, N-1):
        m=max(m, gcd(L[i-1], R[i+1]))
print(m)
A, B, C, K = map(int, input().split())
point = [1] * A + [0] * B + [-1] * C

print(sum(point[:K]))

### FIXED CODE ###

A, B, C, K = map(int, input().split())

if K < A:
    print(K)

elif A <=  K <= A + B:
    print(A)

else:
    print(A - (K - A - B))
import math
def combinations_count(n, r):
  return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

MOD = 10**9+7
N, K = list(map(int, input().split()))

for i in range(K):
  #first N-K+1
  blue = combinations_count(K-1, i)
  red = combinations_count(N-K+1, i+1)
  print(blue*red%MOD)

### FIXED CODE ###

import math
def combinations_count(n, r):
  return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

MOD = 10**9+7
N, K = list(map(int, input().split()))

for i in range(K):
  if K-1 >= i and N-K+1 >= i+1:
    blue = combinations_count(K-1, i)
    red = combinations_count(N-K+1, i+1)
    print(blue*red%MOD)
  else:
    print(0)
K,N=map(int,input().split())
A=list(map(int,input().split()))
A.append(A[0]+K)

D=[]
for i in range(len(A)-1):
    d=A[i+1]-A[i]
    D.append(D)

print(K-max(D))

### FIXED CODE ###

K,N=map(int,input().split())
A=list(map(int,input().split()))
A.append(A[0]+K)

D=[]
for i in range(len(A)-1):
    d=A[i+1]-A[i]
    D.append(d)

print(K-max(D))
import numpy　as np
N = int(input())
a = map(int, input().split())

count = [0] * N
for i in range(N):
  while(a[i] % 2== 1):
    a[i] = a[i] // 2
    count[i] += 1
print(np.min(count))

### FIXED CODE ###

import numpy as np
N = int(input())
a = list(map(int, input().split()))

count = [0] * N
for i in range(N):
  while(a[i] % 2== 0):
    a[i] = a[i] // 2
    count[i] += 1
print(np.min(count))
# coding: utf-8
import sys
input = sys.stdin.readline

N = input()
S = sum(map(int, N))
print(["No", "Yes"][int(N)%S==0])

### FIXED CODE ###

# coding: utf-8
N= input()
S = sum(map(int, N))
print("Yes" if int(N)%S==0 else "No")
def main():
  n = int(input())
  a = [[]]*n
  for i in range(n):
    a[i] = list(map(int, input().split()))

  a.sort()
  print(a[-1][0]+a[-1][1])

main()

### FIXED CODE ###

s = input()
print(s.count("1"))
L= int(input(""))
R= int(input(""))
d= int(input(""))
list=[]
list2=[]
for I in range(L, R+1):
    list.append(I)
for I in list:
    if(I%d == 0):
        list2.append(I)
count=0
for I in list2:
        count= count +1
print(count)
       

### FIXED CODE ###

L,R,d= map(int, input().split())
count=0
for I in range(L, R+1):
    if(I%d == 0):
        count= count +1
print(count)
i = 0
while True:
    i += 1
    x = int(input())
    if x == 0:
        break
    else:
        print('Case {0}: {1}'.format(i, x)

### FIXED CODE ###

i = 0
while True:
    i += 1
    x = int(input())
    if x == 0:
        break
    else:
        print('Case {0}: {1}'.format(i, x))
a,b=imput().split()
a=int(a+b)
for i in range(1,320):
  if i**2==a:
    print('Yes')
    exit(0)
print('No')

### FIXED CODE ###

a,b=input().split()
a=int(a+b)
for i in range(1,320):
  if i**2==a:
    print('Yes')
    exit(0)
print('No')
int A, B, C = input().split()

int D = max(A, B, C)

if A == D :
  print(A * 10 + B + c)
  
elif B == D:
  print(B * 10 + A + C)
  
elif C == D
  print(C * 10 + A + B)

### FIXED CODE ###

A, B, C = map(int, input().split())


ans = max(A*10 + B + C, B*10 + A + C, C*10 + A + B)
print(ans)
n=int(input())
a=input().split()
a2=[int(z) for z in a]
count=0
while True:
  sub=0
  for i in range(n):
    if a2[i]%2!=0:
      break
    else:
      sub+=1
  if sub==n:
    ount+=1
    a2=[int(a2[d]/2) for d in range(n)]
  else:
    break
print(count)

### FIXED CODE ###

N = int(input())
lis = list(map(int, input().split()))

cnt = 0
while True:
  li_yojo = [a % 2 for a in lis]
  if li_yojo.count(0) != N:
    break
  else:
    lis = [ a / 2 for a in lis ]
    cnt += 1
print(cnt)
K,S=map(int,input().split())
asn=0
for i in range(K+1):
  for j in range(i,K+1):
    for k in range(j,K+1):
      if i+j+k==S:
        if i<j<k:
          ans+=6
        elif i<j==k or  i==j<k:
          ans+=3
        else:
          ans+=1
print(ans)
          

### FIXED CODE ###

K,S=map(int,input().split())
ans=0
for i in range(K+1):
  for j in range(K+1):
    k=S-(i+j)
    if 0<=k<=K:
      ans+=1
print(ans)
s,w=map(int,input().split())
if w>=s:
  print("unsafe")
 else:
  print("safe")

### FIXED CODE ###

s,w=map(int,input().split())
if w>=s:
  print("unsafe")
else:
  print("safe")
n = int(input())
numbers = list(map(int, input().split()))
count = [0]*n

for i in range(n):
  while True:
    if numbers[i]%2 == 1:
  	  break
    numbers[i] = numbers[i]/2
    count[i] += 1
  
print(min(count))

### FIXED CODE ###

s = input()
count = 0

for i in range(3):
  if s[i] == '1':
    count += 1
    
print(count)
import bisect
a,b,q=map(int,input().split())
A=[-10**11]
for i in range(a):
  A.append(int(input()))
A.append(10**11)
B=[-10**11]
for i in range(b):
  B.append(int(input()))
B.append(10**11)
for i in range(q):
  x=int(input())
  c=bisect.bisect_left(A,x,hi=len(A))
  d=bisect.bisect_left(B,x,hi=len(A))
  ans=min(abs(A[c-1]-x)+abs(B[d-1]-A[c-1]),abs(A[c-1]-x)+abs(B[d]-A[c-1]),abs(A[c]-x)+abs(B[d-1]-A[c]),abs(A[c]-x)+abs(B[d]-A[c]),abs(B[d-1]-x)+abs(B[d-1]-A[c-1]),abs(B[d-1]-x)+abs(B[d-1]-A[c]),abs(B[d]-x)+abs(B[d]-A[c-1]),abs(B[d]-x)+abs(B[d]-A[c]))
  print(ans)

### FIXED CODE ###

import bisect
a,b,q=map(int,input().split())
A=[-10**11]
for i in range(a):
  A.append(int(input()))
A.append(10**11)
B=[-10**11]
for i in range(b):
  B.append(int(input()))
B.append(10**11)
for i in range(q):
  x=int(input())
  c=bisect.bisect_left(A,x,hi=len(A))
  d=bisect.bisect_left(B,x,hi=len(B))
  ans=min(abs(A[c-1]-x)+abs(B[d-1]-A[c-1]),abs(A[c-1]-x)+abs(B[d]-A[c-1]),abs(A[c]-x)+abs(B[d-1]-A[c]),abs(A[c]-x)+abs(B[d]-A[c]),abs(B[d-1]-x)+abs(B[d-1]-A[c-1]),abs(B[d-1]-x)+abs(B[d-1]-A[c]),abs(B[d]-x)+abs(B[d]-A[c-1]),abs(B[d]-x)+abs(B[d]-A[c]))
  print(ans)
S = input()
N = len(S)

if S[-1] == "1":
    print(-1)
    exit()

S2 = S[:-1]
for i in range(N // 2 + 1):
    if S2[i] != S2[N - i - 1]:
        print(-1)
        exit()

# 構築
T = [[] for i in range(N)]

next = 1
mark = 0
for i in range(N):
    child = mark + 1
    if S[i] == "0":
        next += 1
    else:
        for n in range(next):
            T[mark].append(child)
            child += 1
        next = 1
        mark = child - 1

for i in range(N):
    for t in T[i]:
        print(i+1, t+1)



### FIXED CODE ###

S = input()
N = len(S)

if S[0] == "0" or S[-1] == "1":
    print(-1)
    exit()

D = {}
for i in range(N - 1):
    D[i + 1] = S[i]
for i in range(1, N):
    if D[i] != D[N - i]:
        print(-1)
        exit()

# 構築
T = [[] for i in range(N)]

next = 1
mark = 0
for i in range(N):
    child = mark + 1
    if S[i] == "0":
        next += 1
    else:
        for n in range(next):
            T[mark].append(child)
            child += 1
        next = 1
        mark = child - 1

for i in range(N):
    for t in T[i]:
        print(i + 1, t + 1)