Harryxun/stf_run huggingface dataset:
N = int(input())
A = list(map(int, input().split(" ")))
A.sort()

n_pos = len([a for a in A if a > 0])
operations = []
if n_pos <= (N + 1) // 2:
    pos = [a for a in A if a > 0]
    neg = [a for a in A if a <= 0]
    tmp = pos[0]
    for i in range(n_pos-1):
        operations.append((neg[i], tmp))
        tmp = neg[i] - tmp
        operations.append((pos[i+1], tmp))
        tmp = pos[i+1] - tmp
        
    for i in range(n_pos-1, len(neg)):
        operations.append((tmp, neg[i]))
        tmp = tmp - neg[i]
else:
    neg = A[:N//2]
    pos = A[N//2:]
    if N % 2 == 1:
        tmp = pos[0]
        for i in range(N//2):
            operations.append((neg[i], tmp))
            tmp = neg[i] - tmp
            operations.append((pos[i+1], tmp))
            tmp = pos[i+1] - tmp
    else:
        operations.append(pos[0], neg[0])
        tmp = pos[0] - neg[0]
        if i in range(1, N//2):
            operations.append(neg[i], tmp)
            tmp = neg[i] - tmp
            operations.append(pos[i], tmp)
            tmp = pos[i] - tmp

print(tmp)
for o in operations:
    print("{} {}".format(o[0], o[1]))

### FIXED CODE ###

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

n_pos = len([a for a in A if a > 0])
operations = []
if n_pos == 0:
    pos = [A[-1]]
    neg = A[:-1]
elif n_pos == N:
    pos = A[1:]
    neg = A[:1]
else:
    pos = [a for a in A if a > 0]
    neg = [a for a in A if a <= 0]
if len(pos) >= 2:
    tmp = neg[0]
    for i in range(len(pos)-1):
        operations.append((tmp, pos[i]))
        tmp = tmp - pos[i]
    operations.append((pos[-1], tmp))
    tmp = pos[-1] - tmp
    for i in range(1, len(neg)):
        operations.append((tmp, neg[i]))
        tmp = tmp - neg[i]
else:
    tmp = pos[0]
    for i in range(len(neg)):
        operations.append((tmp, neg[i]))
        tmp = tmp - neg[i]
print(tmp)
for o in operations:
    print("{} {}".format(o[0], o[1]))
n = int(input())
arg_list = int(input())

k = 0
for item in arg_list:
    if item % 2 == 1 :
        k +=1
if k == 1:
    print('YES')
else:
    print('NO')
        

### FIXED CODE ###

n = int(input())
a = map(int, input().split())
count = 0
for i in a:
    if i % 2 == 1:
        count += 1
print("YES" if count % 2 == 0 else "NO")
def main():
    from sys import stdin
    def input():
        return stdin.readline().strip()

    n, m = map(int, input().split())
    tree = [[] for _ in range(n)]
    for _ in range(m):
        i, j, k = map(int, input().split())
        i -= 1
        j -= 1
        tree[i].append((k, j))
        tree[j].append((k, i))

    # dijkstra
    import heapq
    from numpy import zeros

    ans = 0
    for i in range(n):
        for j in tree[i]:
            seen = zeros(n)
            goal = j[1]
            base = j[0]
            seen[i] = 1
            todo = []
            heapq.heapify(todo)
            for k in tree[i]:
                if k[0] < base and k != j:
                    heapq.heappush(todo, k)
            while len(todo) > 0:
                k = heapq.heappop(todo)
                if k[1] == goal:
                    if k[0] < base:
                        ans += 1
                    break
                seen[k[1]] = 1
                for l in tree[k[1]]:
                    if seen[l[1]] == 0 and k[0] + l[0] < base:
                        heapq.heappush(todo, (k[0] + l[0], l[1]))

    print(ans // 2)

main()

### FIXED CODE ###

def main():
    from sys import stdin
    def input():
        return stdin.readline().strip()

    n, m = map(int, input().split())
    tree = [[] for _ in range(n)]
    for _ in range(m):
        i, j, k = map(int, input().split())
        i -= 1
        j -= 1
        tree[i].append((k, j))
        tree[j].append((k, i))

    # dijkstra
    import heapq
    from numpy import zeros

    ans = 0
    for i in range(n):
        for j in tree[i]:
            seen = zeros(n)
            goal = j[1]
            base = j[0]
            seen[i] = 1
            todo = []
            heapq.heapify(todo)
            for k in tree[i]:
                if k[0] < base and k != j:
                    heapq.heappush(todo, k)
            while len(todo) > 0:
                k = heapq.heappop(todo)
                if k[1] == goal:
                    if k[0] < base:
                        ans += 1
                    break
                seen[k[1]] = 1
                for l in tree[k[1]]:
                    if seen[l[1]] == 0 and k[0] + l[0] < base:
                        heapq.heappush(todo, (k[0] + l[0], l[1]))

    print(ans // 2)

main()
N,M=map(int,imput().split())
if N==M:
  print('Yes')
else:
  print('No')


### FIXED CODE ###

N,M=map(int,input().split())
if N==M:
  print('Yes')
else:
  print('No')
print("No" if K < N else "Yes\n" + "\n".join(map(str, range(1, K * 2))))

### FIXED CODE ###

N, K = map(int, input().split())
m = 2 * N - 1

if 2 <= K < m:
    mid = list((3, 2, 1) if K == 2 else (K - 1, K, K + 1, K - 2))
    a = list(set(range(1, m + 1)) - set(mid))
    print("Yes\n" + "\n".join(map(str, a[:m//2 - 1] + mid + a[m//2 - 1:])))
else:
    print("No")
#C
n = int(input())
a = []
testimony = []
ans = 0
for i in range(n):
    a.append(int(input()))#証言の個数
    l = []
    if a[i] == 0:
        l.append([0,0])
        continue
    for j in range(a[i]):
        l.append(list(map(int, input().split())))
    testimony.append(l)#iの人のa[i]個の証言のリスト
for i in range(2**n):
    for j in range(n):
        if (i >> j) & 1:
            for k in range(a[n-1-j]):
                if (i >> (n - testimony[n-1-j][k][0])) != testimony[n-1-j][k][1]:
                    break
            else:
                continue
            break
    else:
        ans = max(ans, str(bin(i)).count('1'))
print(ans)

### FIXED CODE ###

#C
n = int(input())
a = []
testimony = [-1]*n
ans = 0
for i in range(n):
    a.append(int(input()))#証言の個数
    l = []
    for j in range(a[i]):
        l.append(list(map(int, input().split())))
    if l != []:
        testimony[i] = l#iの人のa[i]個の証言のリスト
for i in range(2**n):
    for j in range(n):
        if (i >> j) & 1 and testimony[n-1-j] != -1:
            for k in range(a[n-1-j]):
                if ((i >> (n - testimony[n-1-j][k][0])) & 1) != testimony[n-1-j][k][1]:
                    break
            else:
                continue
            break
    else:
        ans = max(ans, str(bin(i)).count('1'))
print(ans)
from itertools import product

N = int(input())
num_list = ["3", "5", "7"]
count = 0

for i in range(2,10):
    for t in product(num_list, repeat=i):
        check = t.count("3")*t.count("5")*t.count("7")
        if int("".join(t)): <= N and check:
            count += 1

print(count)

### FIXED CODE ###

from itertools import product

N = int(input())
num_list = ["3", "5", "7"]
count = 0

for i in range(3, 10):
    for t in (product(num_list, repeat=i)):
        check = t.count("3")*t.count("5")*t.count("7")
        if int("".join(t)) <= N and check:
            count += 1


print(count)
n=int(input())
a,b=map(int,input().split())

for i in range(a,b+1):
    if i%n==0:
        flag=1
if flag==1:
    print("OK")
else:
    print("NG")


### FIXED CODE ###

n=int(input())
a,b=map(int,input().split())
flag=0
for i in range(a,b+1):
    if i%n==0:
        flag=1
if flag==1:
    print("OK")
else:
    print("NG")
from collections import defaultdict
from itertools import combinations
def solve():
    n = int(input())
    XY = [list(map(int, input().split())) for _ in range(n)]
    m = defaultdict(int)
    for i, j in combinations(range(n), 2):
        m[(XY[i][0] - XY[j][0], XY[i][1] - XY[j][1])] += 1
        m[(XY[j][0] - XY[i][0], XY[j][1] - XY[i][1])] += 1
    print(n - max(m.items(), key=lambda x: x[1])[1])
solve()


### FIXED CODE ###

from collections import defaultdict
from itertools import permutations
def solve():
    n = int(input())
    XY = [list(map(int, input().split())) for _ in range(n)]
    if n == 1:
        return 1
    m = defaultdict(int)
    for i, j in permutations(range(n), 2):
        m[(XY[i][0] - XY[j][0], XY[i][1] - XY[j][1])] += 1
    return n - max(m.items(), key=lambda x: x[1])[1]
print(solve())
n = [int(input()) for hoge in range(5)]
c = 0
t = 0
a = []
while t < 5:
  if n[t]%10 == 0:
    c += n[t]
  else:
    c += (n[t]//10 + 1)*10
    a.append(n[t]%10)
  t += 1
c -= (10-min(a))
print(c)

### FIXED CODE ###

n = [int(input()) for hoge in range(5)]
c = 0
t = 0
a = [10]
while t < 5:
  if n[t]%10 == 0:
    c += n[t]
  else:
    c += (n[t]//10 + 1)*10
    a.append(n[t]%10)
  t += 1
c -= (10-min(a))
print(c)
n = int(input())                                                                                                                                                                                         
data = [0] * n                                                                                                                                                                                           
                                                                                                                                                                                                             
for a in range(n):                                                                                                                                                                                       
　t = int(input())                                                                                                                                                                                     
  data[t] += 1                                                                                                                                                                                         
                                                                                                                                                                                                             for a in range(n):                                                                                                                                                                                       
　if data[a] == 0:                                                                                                                                                                                     
  　print('-')                                                                                                                                                                                          　else:                                                                                                                                                                                                
　　for t in range(data[a]):                                                                                                                                                                         
　　　print('*', end='')                                                                                                                                                                           
　　print()                     

### FIXED CODE ###

#!/usr/bin/env python3

d_init = [0] * 10
while True:
    data = d_init[:]
    n = int(input())
    if n == 0:
        break

    for _ in range(n):
        in_data = int(input())
        data[in_data] += 1

    for d in data:
        if d == 0:
            print("-")
        else:
            print("*" * d)
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=int(input())
h=list(map(int, input().split()))
x=1
ans=h[0]
for i in range(1,n):
    if h[0]>=h[1] and h[0]>=h[2]:
        x=0
        print(1)
        sys.exit()
    if h[i]>=h[i-1]:
        x=x+1 
print(x)

### FIXED CODE ###

n=int(input())
h=list(map(int, input().split()))
x=1
ans=h[0]
for i in range(1,n):
    if h[i]>=ans:
        x=x+1 
        ans=h[i]
print(x)
a, b = map(int, input().split())
s = input()
print("Yes" if s.count("-") == 1 and s[a] == "-" and s.count() == a+b+1 else "No")

### FIXED CODE ###

a, b = map(int, input().split())
s = input()
print("Yes" if s.count("-") == 1 and s[a] == "-" else "No")
-*- coding: utf-8 -*-

import sys
import subprocess
import json
import time
import math
import re
import sqlite3

s = input()
print(1)




### FIXED CODE ###

s = input()
     
a = s.find("A")
b = s.rfind("Z")
     
print(b-a+1)
N,Q=(int(i) for i in input().split())
x=input()
a=[]

j=0
s=[]
while (j<len(x)-1):
  if (x[j]=="A"):
    if (x[j+1]=="C"):
      s.append(j+1)
      j+=1
  j+=1
for i in range(0,Q):
  a.append([int(j) for j in input().split()])
  answer=0
  j=0
  while s[j]<a[i][0]:
    j+=1
    if len(s)<=j:break
  k=0
  while s[k]<a[i][1]:
    k+=1
    if len(s)<=k:break
  print(k-j)




### FIXED CODE ###

N,Q=(int(i) for i in input().split())
x=input()
a=[]

j=0
s=[0]
t=0
while (j<N-1):
  if (x[j]=="A") and (x[j+1]=="C"):
    t+=1
    s.append(t)
  else:s.append(t)
  j+=1
for i in range(0,Q):
  a.append([int(j) for j in input().split()])
  p=s[a[i][1]-1]-s[a[i][0]-1]
  print(p)
#解説見た
n = int(input())
p = list(map(int, input().split()))
ans = 0
for i in range(n):
    if p[i] == (i+1):
        p[i],p[i+1] = p[i+1], p[i]
        ans += 1

print(ans)

### FIXED CODE ###

#解説見た
n = int(input())
p = list(map(int, input().split()))
p.append(0)
ans = 0
for i in range(n):
    if p[i] == (i+1):
        p[i],p[i+1] = p[i+1], p[i]
        ans += 1

print(ans)
#標準入力
N = int(input())
A = list(map(int, input().split()))
 
#累積和
S = [0]*N
for n in range(N):
  S[n] = S[n-1] + A[n]
  
_sum = 0
for i in range(N-1):
  _sum = _sum + (A[i] * (S[N] - S[i+1]))

#modulo
_sum = _sum % (1000000000+7)
  
print(_sum)

### FIXED CODE ###

#標準入力
N = int(input())
A = list(map(int, input().split()))

#累積和
S = [0]*N
for n in range(N):
  S[n] = S[n-1] + A[n]

_sum = int(0)
for i in range(N-1):
  _sum = _sum + (A[i] * (S[-1] - S[i]))

#modulo
_sum = _sum % (1000000000+7)
  
print(_sum)
import Queue, sys
INF = 10**9+7
n = input()
p = []
for i in xrange(n):
    p.append(int(raw_input()))
dist = [10**7] * n
calc = [-1] * n
used = [False] * n
que = Queue.PriorityQueue()
que.put((0, 0))
dist[0] = 0
sys.setrecursionlimit(10**5+7)
def dfs(pos, calc, used, f):
    if p[pos]==0:
        return pos
    if calc[pos]!=-1:
        return calc[pos]
    if used[pos]:
        return INF
    used[pos] = True
    calc[pos] = dfs(pos+p[pos], calc, used, p[pos])
    used[pos] = False
    return calc[pos]
while not que.empty():
    co, v = que.get()
    if dist[v] < co:
        continue
    for k in xrange(1, 7):
        go = v+k
        if go>=n:
            break
        if p[go] != 0:
            if calc[go]==-1:
                dfs(go, calc, used, 0)
            if calc[go]==INF:
                continue
            go = calc[go]
        if go==n-1:
            print dist[v]+1
            exit(0)
        if dist[v] + 1 < dist[go]:
            dist[go] = dist[v] + 1
            que.put((dist[go], go))

### FIXED CODE ###

import Queue
INF = 10**9
n = input()
p = [i+int(raw_input()) for i in xrange(n)]

used = [0] * n
idx = 0
for i in xrange(n):
    if p[i]!=i:
        path = []
        go = i
        idx += 1
        while go!=INF and p[go]!=go:
            if used[go]==idx:
                go = INF
                break
            used[go] = idx
            path.append(go)
            go = p[go]
        for e in path:
            p[e] = go

dist = [INF] * n
que = Queue.Queue()
que.put(0)
dist[0] = 0
while not que.empty():
    v = que.get()
    for k in xrange(1, min(7, n-v)):
        go = p[v+k]
        if go==n-1:
            print dist[v]+1
            exit(0)
        if go!=INF and dist[v] + 1 < dist[go]:
            dist[go] = dist[v] + 1
            que.put(go)
S = input()
T = input()

if S == T[0:len(S)]:
  print('YES')
else:
  pritn('NOa')

### FIXED CODE ###

S = input()
T = input()

if S == T[0:len(S)]:
  print('Yes')
else:
  print('No')
def edit_distance(M):
 n = len(M)
 A = [[0 for i in range(n)] for j in range(n)]
 for l in range(2, n+1):
  for i in range(0, n-l+1):
   k = i+l-1
   def f(i,j,k):
    return A[i][j-1]+A[j][k]+M[i][0]*M[j-1][1]*M[k][1]
   A[i][k] = min([f(i,j,k) for j in range(i+1,k+1)])
 return A[0][n-1]
n = input()
M = []
for i in range(n):
 M.append(map(int, raw_input().split()))
print edit_distace(M)

### FIXED CODE ###

def edit_distance(M):
  n = len(M)



  m = [[0 for i in range(n)] for j in range(n)]
   
  for long in range(2, n+1):

    for i in range(0, n-long+1):

      j = i + long - 1

      def a(i, k ,j):
        return m[i][k] + m[k+1][j] + M[i][0]*M[k][1]*M[j][1]
      m[i][j] = min(a(i, k, j) for k in range(i, j))
   
  return m[0][n-1]
 
n = input()
M = []
 
for i in range(n):
  M.append(map(int, raw_input().split()))
print edit_distance(M)
S,T = input().split()
N,M = list(map(int, input().split()))
s = input()
print(f"{N-1} {M}" if s == S else f"{N} {M-1}") 

### FIXED CODE ###

S,T = input().split()
N,M = list(map(int, input().split()))
s = input()
if s == S:
  print(N-1, M)
else:
  print(N, M-1)
from itertools import accumulate
import numpy as np
N=int(input())
L=[26**(i+1) for i in range(10)]
sL=list(accumulate(L))
result=[]
for i in range(10):
    if N<=sL[i]:
        N-=sL[i-1]
        k=i
        break
for m in range(k):
    time=0
    while N>=L[k-m-1]:
        N-=L[k-m-1]
        time+=1
    result.append(chr(time+97).translate(correspond))
result.append(chr(N+96))
print(''.join(result))

### FIXED CODE ###

from itertools import accumulate
import numpy as np
N=int(input())
N-=1
L=[26**(i+1) for i in range(15)]
sL=list(accumulate(L))
result=[]
k=0
for i in range(15):
    if N+1<=sL[i] and N>=25:
        N-=sL[i-1]
        k=i
        break
for m in range(k):
    time=0
    while N>=L[k-m-1]:
        N-=L[k-m-1]
        time+=1
    result.append(chr(time+97))
result.append(chr(N+97))
print(''.join(result))
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

n = str(input())
l1 = []
for c in n:
	l1.append(c)

z, o = '0', '1'

one, zero = [], []

for i in range(len(l1)):
	if i%2 == 0:
		one.append(o)
		zero.append(z)
	else:
		one.append(z)
		zero.append(o)

c1, c2 = 0,0
for i in range(len(l1)):
	if l[i] == one[i]:
		c1 += 1
	if l[i] == zero[i]:
		c2 += 1

ans = min(c1, c2)
print(ans)

### FIXED CODE ###

#!/usr/bin/env python3
# -*- coding: utf-8 -*-

n = str(input())
l1 = []
for c in n:
	l1.append(c)

z, o = '0', '1'

one, zero = [], []

for i in range(len(l1)):
	if i%2 == 0:
		one.append(o)
		zero.append(z)
	else:
		one.append(z)
		zero.append(o)

c1, c2 = 0,0
for i in range(len(l1)):
	if l1[i] == one[i]:
		c1 += 1
	if l1[i] == zero[i]:
		c2 += 1

ans = min(c1, c2)
print(ans)
S=str(input())
print(S[0:5]+' '+S[6:13]+' 'S[14:19])

### FIXED CODE ###

S=str(input())
print(S[0:5]+' '+S[6:13]+' '+S[14:19])
s = input()
if s == 'AAA' or s == 'BBB'
  print('No')

else print('Yes')


### FIXED CODE ###

s = input()
if s == 'AAA' or s == 'BBB':
  print('No')

else:
  print('Yes')
a = int([input()])
b = a[1]*a[2]
if b >= a[0]:
  print('Yes')
elif b < a[0]:
  print('No')

### FIXED CODE ###

a,b,c = map(int, input().split())
if a <= b*c :
  print('Yes')
elif a > b*c :
   print('No')
N = int(input())
count = []

for a in range(1,N//2+1):
    if N % a == 0:
        b = N // a
        count.append(max(len(str(a)),len(str(b))))

print(min(count))

### FIXED CODE ###

N = int(input())
count = []

for a in range(1,int(N**0.5+1)):
    if N % a == 0:
        b = N // a
        count.append(max(len(str(a)),len(str(b))))

print(min(count))
a = map(int, input().split())
X, Y = a[0], a[1]
print(X + Y // 2)

### FIXED CODE ###

X, Y = map(int, input().split())

print(X + Y // 2)
import sys
N,M,*X = map(int, open(0).read().split())

X.sort()

ans = []
for i in range(len(X)-1):
    ans.append(abs(X[i+1] - X[i]))

if len(ans) == 0:
    print(0)
    sys.exit()

ans.sort()
for _ in range(N-1):
    ans.pop()

print(sum(ans))


### FIXED CODE ###

import sys

# N: コマ数
# M: 地点数

N,M,*X = map(int, open(0).read().split())

# コマ数が地点数以上の場合、各地点にコマを配置できる
# よって 0 回の移動で目的を達成できる
if N >= M:
    print(0)
    sys.exit()

X.sort()
ans = []
for i in range(M-1):
    ans.append(abs(X[i+1] - X[i]))

ans.sort(reverse=True)
print(X[-1] - X[0] - sum(ans[:N-1]))
A=input()
B=input()
if(A==1 and B==2):
  answer=3
elif(A==2 and B==3):
  answer=1
elif(A==3 and B==1):
  answer=2
print(answer)

### FIXED CODE ###

A=int(input())
B=int(input())
if(A==1 and B==2):
  answer=3
elif(A==1 and B==3):
  answer=2
elif(A==2 and B==3):
  answer=1
elif(A==2 and B==1):
  answer=3
elif(A==3 and B==1):
  answer=2
elif(A==3 and B==2):
  answer=1
print(answer)
N = int(input())
A = list(map(int, input().split()));
lis = [0]*N
ans = [0]*N
ans_selected = [0]*N
ans_sum = 0

for i in A:
    lis[i] += 1

for num, i in enumerate(lis):
    ans[num] = i * (i-1) // 2
    ans_sum += i * (i-1) // 2
    if i != 0:
        ans_selected[num] = (i-1) * (i-2) // 2

for i in A:
    print(ans_sum - ans[i] + ans_selected[i])


### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()));
lis = [0]*(N+1)
ans = [0]*(N+1)
ans_selected = [0]*(N+1)
ans_sum = 0

for i in A:
    lis[i] += 1

for num, i in enumerate(lis):
    ans[num] = i * (i-1) // 2
    ans_sum += i * (i-1) // 2
    if i != 0:
        ans_selected[num] = (i-1) * (i-2) // 2

for i in A:
    print(ans_sum - ans[i] + ans_selected[i])
a=input()
while a[2]!="?":
    print(int(eval(a)))
    a=input()


### FIXED CODE ###

while 1:
  s=input()
  if s.split()[1]=="?":exit()
  print(int(eval(s)))
n, m = map(int, input().split())
x = list(map(int, input().split()))
 
if n >= len(x):
    print(0)
    exit()
l = []
x.sort()
 
for i in range(m-1):
    diff = x[i+1] - x[i]
    ls.append(diff)
l.sort(reverse=True)
ans = sum(ls)
 
for i in range(n-1):
    ans -= ls[i]
print(ans)

### FIXED CODE ###

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

if n >= len(x):
    print(0)
    exit()

ls = []
x.sort()

for i in range(m-1):
    diff = x[i+1] - x[i]
    ls.append(diff)

ls.sort(reverse=True)
ans = sum(ls)

for i in range(n-1):
    ans -= ls[i]

print(ans)
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

ae = [a, b, c, d, e]

time = 0

for i in ae:
    if i % 10 == 0:
        time += i

ae = [i for i in ae if i % 10 != 0]

idx = 0
for i in ae:
    time += i
    time += 10 - (i % 10)

one = []
for i in ae:
    i = [j for j in str(i)]
    one.append(int(i[-1]))

print(time-10+min(one))


### FIXED CODE ###

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

ae = [a, b, c, d, e]

time = 0

for i in ae:
    if i % 10 == 0:
        time += i

ae = [i for i in ae if i % 10 != 0]

if ae:
    idx = 0
    for i in ae:
        time += i
        time += 10 - (i % 10)

    one = []
    for i in ae:
        i = [j for j in str(i)]
        one.append(int(i[-1]))

    print(time-10+min(one))

else:
    print(time)
from itertools import product

H, W = map(int, input().split())

s = []
for i in range(H):
    s.append(list(input()))

for h, w in [(h, w) for h, w in product(range(H), range(W)) if s[h][w] != '.']:
    R = False
    if h > 0 and s[h - 1][w] == '#':
        # 上
        R = True
    if h < H - 1 and s[h + 1][w] == '#':
        # 下
        R = True
    if w > 0 and s[h][w - 1] == '#':
        # 左
        R = True
    if w < W - 1 and s[h][w + 1] == '#':
        # 右
        R = True

    if not R:
        print('No')
        exit()

print('Yes')

### FIXED CODE ###

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

r = a - 1 if b < a else a

print(r)