Harryxun/stf_run huggingface dataset:
N, K = map(int, input().split())
XY = [list(map(int, input().split())) for _ in range(N)]

answer = []
for i in range(N):
  for j in range(i + 1, N):
    x1, x2 = min(XY[i][0], XY[j][0]), max(XY[i][0], XY[j][0])
    y1, y2 = min(XY[i][1], XY[j][1]), max(XY[i][1], XY[j][1])
    
    cnt = 0
    for n in range(N):
      x3, y3 = XY[n]
      if x1 <= x3 <= x2 and y1 <= y3 <= y2:
        cnt += 1
    if cnt == K:
      answer.append((x2 - x1) * (y2 - y1))
print(min(answer))

### FIXED CODE ###

N, K = map(int, input().split())
XY = [list(map(int, input().split())) for _ in range(N)]

XY.sort()
#print("XY:", XY)

answer = []
for i in range(N):
  for k in range(K, N + 1):
    if i + k - 1 >= N:
      break
    dx = XY[i + k - 1][0] - XY[i][0]
    Y = []
    for x, y in XY[i: i + k]:
      Y.append(y)
    Y.sort()
    lenY = len(Y)
    for j in range(k):
      if j + K - 1 == lenY:
        break
      dy = Y[j + K - 1] - Y[j]
      answer.append(dx * dy)

print(min(answer))
K = int(input())
S = input()

m = 1000000007

result = 0
t = pow(26, K, m)
u = pow(26, -1, m) * 25 % m
l = len(S)
for i in range(K + 1):
    # result += pow(26, K - i, m) * mcomb(len(S) - 1 + i, i) * pow(25, i, m)
    result = (result + t) % m
    t = (t * u) % m * (l + i) % m * pow(i + 1, -1, m) % m
print(result)


### FIXED CODE ###

# フェルマーの小定理
K = int(input())
S = input()

m = 1000000007


def make_factorial_table(n):
    result = [0] * (n + 1)
    result[0] = 1
    for i in range(1, n + 1):
        result[i] = result[i - 1] * i % m
    return result


def mcomb(n, k):
    if n == 0 and k == 0:
        return 1
    if n < k or k < 0:
        return 0
    return fac[n] * pow(fac[n - k], m - 2, m) * pow(fac[k], m - 2, m) % m


fac = make_factorial_table(len(S) + K)

result = 0
for i in range(K + 1):
    result += pow(26, i, m) * mcomb(len(S) - 1 + K - i, len(S) - 1) * pow(25, K - i, m)
    result %= m
print(result)
n,m=map(int,input().split())
L=list(map(int,input().split()))
L.sort()

#d=np.array([L[i+1]-L[i] for i in range(m-1)])
d=[L[i+1]-L[i] for i in range(m-1)]
ans=L[m-1]-L[0]

for i in range(n-1):
  #a=np.argmax(d)
  a=d.index(max(d))
  d[a]=0
  ans-=(L[a+1]-L[a])
  




print(ans)

### FIXED CODE ###

n,m=map(int,input().split())
L=list(map(int,input().split()))
L.sort()
if n>=m:
  print(0)
elif m!=1:

  d=[L[i+1]-L[i] for i in range(m-1)]
  d.sort()
  d.reverse()
  ans=L[-1]-L[0]


  ans-=sum(d[:n-1])
  print(ans)
  

else:
  print(0)
#include <bits/stdc++.h>
using namespace std;
int main()
{
  int N;
  cin >> N;
  int count= 0;
  
  vector<int> p(N);
  for (int i=1 ;i < N ;i++) {
    cin >> p[i];
    if (p[i-1]+1 != p[i+1]) {
      count++;
      }
    }
  
  if (count == 0 || count ==2){
    cout << "YES" << endl;
  }
  else cout << "NO" << endl;
}


### FIXED CODE ###

n = int(input())
li = list(map(int,input().split()))
count = 0
for i in range(n):
  if(li[i] != i+1):
    count += 1
if(count == 0 or count == 2):
  print("YES")
else:
  print("NO")
def findset(x):
    global nodes
    if nodes[x].parent==x:
        return x
    else:
        nodes[x].parent=findset(nodes[x].parent)
        return nodes[x].parent

def unite(x,y):
    global rank,nodes
    if rank[nodes[x].parent]<rank[nodes[y].parent]:
        nodes[nodes[x].parent].parent=nodes[nodes[y].parent].parent
    elif rank[nodes[x].parent]==rank[nodes[y].parent]:
        nodes[nodes[x].parent].parent=nodes[nodes[y].parent].parent
        rank[y]+=1
    else:
        nodes[nodes[y].parent].parent=nodes[nodes[x].parent].parent

def same(x,y):
    global nodes
    findset(x)
    findset(y)
    if nodes[x].parent==nodes[y].parent:
        print(1)
    else:
        print(0)

n,q=map(int,raw_input().split())
rank=[0]*n
nodes=[]
for i in xrange(n):
    fac=node(i)
    nodes.append(fac)
for i in xrange(q):
    com,x,y=map(int,raw_input().split())
    if com==0:
        unite(x,y) 
    else:
        same(x,y)

### FIXED CODE ###

# -*- coding: utf-8 -*-
class UnionFind:
    def __init__(self,size):
        self.parent=range(size)#???????????????????????????
        self.tree_num=size#??¨????????¨?????°
        self.tree_w=[1]*size#????????????????????????????±???????????????¨??????????????°
        self.rank=[0]*size#??¨?????????

    def findset(self,x):#????????¢????????????x??????????????§?????£???????????????????????????????????????
        if self.parent[x]==x:
            return x
        else:
            self.parent[x]=self.findset(self.parent[x])
            return self.parent[x]

    def unite(self,x,y):#x,y?????????
        x=self.findset(x)
        y=self.findset(y)
        if x==y:
            return
        if self.rank[x]<self.rank[y]:
            self.parent[x]=y
            self.tree_num-=1
            self.tree_w[y]+=self.tree_w[x]
        else:
            self.parent[y]=x
            self.tree_num-=1
            self.tree_w[x]+=self.tree_w[y]
            if self.rank[x]==self.rank[y]:
                self.rank[x]+=1

    def same(self,x,y):#x,y???????????¨????±????????????????????????????
        if self.findset(x)==self.findset(y):
            return True
        else:
            return False

    def tree_number(self):#??¨????????¨?????°
        return self.tree_num

    def tree_weight(self,x):#x????±?????????¨??????????????°
        return self.tree_w[self.findset(x)]

n,q=map(int,raw_input().split())
uf=UnionFind(n)
for i in xrange(q):
    com,x,y=map(int,raw_input().split())
    if com==0:
        uf.unite(x,y)
    else:
        if uf.same(x,y):
            print(1)
        else:
            print(0)
N,R = map(int,input().split())
if N < 10 :
    print(R - 100*(10-K))
else :
    print(R)

### FIXED CODE ###

N,R = map(int,input().split())
if N < 10 :
    print( R + 100*(10 - N) )
else :
    print( R )
import math, string, fractions, heapq, re, array, bisect, sys, random, time, copy
import itertools as it
import operator as op
import collections as cl
import functools as ft
import pandas as pd
import numpy as np

def LI(): return list(map(int, input().split()))
def LI_(): return list(map(lambda x: int(x) - 1, input().split()))
def LF(): return list(map(float, input().split()))
def LS(): return input().split()
def I(): return int(input())
def F(): return float(input())
def S(): return input()


if __name__ != "__main__":
    N, M, Q = LI()
    LR = np.ndarray((M, 3), dtype='uint32')

    for i in range(M):
        LR[i][0], LR[i][1] = LI()
        LR[i][2] = i

    L = pd.DataFrame(LR).sort_values(0)
    R = pd.DataFrame(LR).sort_values(1)

    for _ in range(Q):
        l = L.copy()


if __name__ != "__main__":
    N, M, Q = LI()
    LR = np.ndarray((M, 4), dtype='uint32')

    for i in range(M):
        LR[i][0], LR[i][1] = LI()

    LR = pd.DataFrame(LR)

    for _ in range(Q):
        p, q = LI()
        LR[2] = p <= LR[0]
        LR[3] = LR[1] <= q
        print(sum(LR[2]*LR[3]))


if __name__ == "__main__":
    N, M, Q = LI()
    LR = np.ndarray((4, M), dtype='uint32')

    for i in range(M):
        LR[0][i], LR[1][i] = LI()

    for _ in range(Q):
        p, q = LI()
        LR[2] = p <= LR[0]
        LR[3] = LR[1] <= q
        print(sum(LR[2]*LR[3]))


### FIXED CODE ###

def LI(): return list(map(int, input().split()))
def LI_(): return list(map(lambda x: int(x) - 1, input().split()))


if __name__ == "__main__":
    N, M, Q = LI()
    LR = [[0]*(N+1) for _ in range(N+1)]
    for i in range(M):
        l, r = LI()
        LR[l][r] += 1

    # 二次元累積和
    for i in range(1, N+1):
        for j in range(1, N+1):
            LR[i][j] += LR[i][j-1]
            LR[i][j] += LR[i-1][j]
            LR[i][j] -= LR[i-1][j-1]

    for _ in range(Q):
        p, q = LI()
        p -= 1
        result = LR[q][q] - LR[p][q] - LR[q][p] + LR[p][p]
        print(result)
W, H, N = map(int, input().split())
xya = []
for _ in range(N):
  xya.append( list( map(int, input().split() ) ) )
  
W_0 = H_0 = 0
  
for i in range(N):
  
  if xya[i][2] == 1:
    W_0 =  xya[i][0]
    
  else if xya[i][2] == 2:
    W = xya[i][0]
    
  else if xya[i][2] == 3:
    H_0 = xya[i][1]
    
  else if xya[i][2] == 4:
    H = xya[i][1]
    
  if (W - W_0 == 0) or (H - H_0 == 0):
    break
    
print(max([(W - W_0)*(H - H_0), 0]))

### FIXED CODE ###

W, H, N = map(int, input().split())
xya = []
for _ in range(N):
  xya.append( list( map(int, input().split() ) ) )
  
W_0 = H_0 = 0
  
for i in range(N):
  
  if xya[i][2] == 1:
        if W_0 < xya[i][0]:
            W_0 =  xya[i][0]
    
  elif xya[i][2] == 2:
        if W > xya[i][0]:
            W = xya[i][0]
    
  elif xya[i][2] == 3:
        if H_0 < xya[i][1]:
            H_0 = xya[i][1]
    
  elif xya[i][2] == 4:
        if H > xya[i][1]:
            H = xya[i][1]
    
  if (W - W_0 <= 0) or (H - H_0 <= 0):
    break
    
print(max([(W - W_0)*(H - H_0), 0]))
r1,c1,r2,c2=map(int,input().split())
mod=pow(10,9)+7

# コンビネーション、さらに高速。あらかじめO(N)の計算をすることでのちの計算が早くなる
def cmb(n,r,mod):
  if (r<0 or r>n):
    return 0
  r=min(r,n-r)
  return g1[n]*g2[r]*g2[n-r]%mod
g1=[1,1] # g1[i]=i! % mod　:階乗
g2=[1,1] # g2[i]=(i!)^(-1) % mod　:階乗の逆元
inverse=[0,1]
n=max(r1,c1,r2,c2)
for i in range(2,2*10**6+1):
  g1.append((g1[-1]*i)%mod)
  inverse.append((-inverse[mod%i]*(mod//i))%mod)
  g2.append((g2[-1]*inverse[-1])%mod)
ans=0
for k in range(r1,r2+1):
  tmp=cmb(k+1+c2,c2,mod)-cmb(k+1+c1-1,c1-1,mod)
  ans+=tmp
  ans%=mod
print(ans)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**7)

def main():
  r1,c1,r2,c2=map(int,input().split())
  mod=pow(10,9)+7

  # コンビネーション、さらに高速。あらかじめO(N)の計算をすることでのちの計算が早くなる
  def cmb(n, r, mod):
      if ( r<0 or r>n ):
          return 0
      r = min(r, n-r)
      return g1[n] * g2[r] * g2[n-r] % mod
  g1 = [1, 1] 
  g2 = [1, 1] 
  inverse = [0, 1]
  for i in range( 2, r2+c2+3):
      g1.append( ( g1[-1] * i ) % mod )
      inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
      g2.append( (g2[-1] * inverse[-1]) % mod )
  ans=0
  for r in range(r1,r2+1):
    ans+=cmb(r+c2+1,r+1,mod)-cmb(r+c1,r+1,mod)
    ans%=mod
  print(ans)

if __name__=='__main__':
  main()
s=input()
k=int(input())
i=0
while True:
  if s[i]=='1' or i<len(s):
    i+=1
  else:
    break
if i<k-1:
  print(s[1])
else:
  print(1)

### FIXED CODE ###

s=input()
k=int(input())
i=0
while True:
  if i<len(s) and s[i]=='1':
    i+=1
  else:
    break
if i==0:
  print(s[0])
  exit()
if i<k:
  print(s[i])
else:
  print(s[0])
N, M = [int(x) for x in input().split()]

# Union Find
# N = 100
PARENT = list(range(N))

used = set()


def root(n):
    if PARENT[n] == n:
        return n
    else:
        ret = root(PARENT[n])
        PARENT[n] = ret
        return ret


def same(n1, n2):
    return root(n1) == root(n2)


def unite(n1, n2):
    n1 = root(n1)
    n2 = root(n2)
    if n1 == n2:
        return
    PARENT[n1] = n2


for i in range(M):
    x, y, z = [int(x) for x in input().split()]
    x -= 1
    y -= 1
    used.add(x)
    used.add(y)
    rootX = root(x)
    rootY = root(y)
    if z % 2 == 0:
        unite(x, y)

cnt = 0
uf = {root(n) for n in used}

ans = (len(uf) + 1) // 2 + (N - len(used))
print(ans)


### FIXED CODE ###

import sys
sys.setrecursionlimit(100000)

N, M = [int(x) for x in input().split()]

# Union Find
# N = 100
PARENT = list(range(N))

def root(n):
    if PARENT[n] == n:
        return n
    else:
        ret = root(PARENT[n])
        PARENT[n] = ret
        return ret

def same(n1, n2):
    return root(n1) == root(n2)

def unite(n1, n2):
    n1 = root(n1)
    n2 = root(n2)
    if n1 == n2:
        return
    PARENT[n1] = n2

used = set()

for i in range(M):
    x, y, z = [int(x) for x in input().split()]
    x -= 1
    y -= 1
    unite(x, y)

cnt = 0
for i,p in enumerate(PARENT):
    if root(p) == i:
        cnt += 1
print(cnt)
A=[1,2,3]
A.pop(A.insert(input()))
A.pop(A.insert(input()))
print(A[-1])

### FIXED CODE ###

A=["1","2","3"]
A.pop(A.index(input()))
A.pop(A.index(input()))
print(A[0])
e=[input()for _ in[0]*int(input())]
for s in"SHCD":
 for r in range(1,14):
  if f'{s} {r}'not in e:print(s,r)


### FIXED CODE ###

input()
print(*input().split()[::-1])
s=input()
t=input()
a,b=map(int,input().split())
u=input()
if u==s:
    print(a-1,b)
if u==t:
    print(a,b-1)

### FIXED CODE ###

s,t=map(str,input().split())
a,b=map(int,input().split())
u=input()
if u==s:
    print(a-1,b)
if u==t:
    print(a,b-1)
def incr_lunlun(num):
    num[0] += 1
    if len(num) == 1:
        if num[0] == 10:
            num.append(1)
            num[0] = 0

    elif num[0] > num[1] + 1 or num[0] == 10:
        suffix = incr_lunlun(num[1:])
        num = [suffix[0] - 1] + list(suffix)

    return num


def main():
    k = int(input())
    num = [1]
    for i in range(k-1): 
        num = incr_lunlun(num)

    print(int(''.join(str(i) for i in reversed(num))))



main()


### FIXED CODE ###

def incr_lunlun(num):
    num[0] += 1
    if len(num) == 1:
        if num[0] == 10:
            num.append(1)
            num[0] = 0
    
    elif num[0] > num[1] + 1 or num[0] == 10:
        suffix = incr_lunlun(num[1:])
        digit = max(0, suffix[0] - 1)
        num = [digit] + list(suffix)

    return num


def main():
    k = int(input())
    num = [1]
    for i in range(k-1): 
        num = incr_lunlun(num)

    print(int(''.join(str(i) for i in reversed(num))))



main()
from fractions import gcd
import sys
input = sys.stdin.readline

n = int(input())
ans = 1
for _ in range(n):
    t = int(input())
    ans = ans*x//gcd(ans, x)
print(ans)

### FIXED CODE ###

from fractions import gcd
import sys
input = sys.stdin.readline

n = int(input())
ans = 1
for _ in range(n):
    t = int(input())
    ans = ans*t//gcd(ans, t)
print(ans)
A, B, K = (int(i) for i in input().split())
list = []
for i in range(1, 101):
  if A % == 0 and B % i == 0:
    list.append(i)
print(list[len(list)-K])


### FIXED CODE ###

A, B, K = (int(i) for i in input().split())
list = []
 
for i in range(101):
  if i != 0:
    if A % i == 0 and B % i == 0:
      list.append(i)
print(list[len(list)-K])
import bisect

# n = int(input())
# s = list(map(int, input().split(" ")))
# n = 18
# s = list(reversed(range(1, 2 ** n + 1)))

s = sorted(s)
from collections import deque

def solve():
    parents = [s[-1]]
    s.pop()

    for i in range(n):
        newparents = list(parents)
        print(parents)
        for p in parents:
            k = bisect.bisect(s, p) - 1
            # print(p, s, k)
            if k == -1:
                print("No")
                exit(0)
            newparents.append(s[k])
            s.pop(k)
        parents = sorted(newparents, reverse=True)

    print(parents)
    # print(k)
    if k == len(s):
        print("Yes")
    else:
        print("No")
solve()


### FIXED CODE ###

import bisect

n = int(input())
s = list(map(int, input().split(" ")))
# n = 18
# s = list(reversed(range(1, 2 ** n + 1)))

s = sorted(s)
from collections import deque

def solve():
    global s

    parents = [s[-1]]
    s.pop()

    for i in range(n):
        newparents = list(parents)
        k = len(s)
        dropped = set()
        # print(parents)
        for p in parents:
            oldK = k
            k = bisect.bisect(s, p - 1, 0, k) - 1
            # print("Old", oldK, k, s[k], p)
            if k == -1:
                print("No")
                exit(0)

            newparents.append(s[k])
            dropped.add(k)
        s = [x for i, x in enumerate(s) if i not in dropped]
        parents = sorted(newparents, reverse=True)

    # print(parents)
    # print(k)
    if k == len(s):
        print("Yes")
    else:
        print("No")
solve()
#C Bugged
import numpy as np
a = int(input())
k   = []
k10 = []
s = 0

for j in range(a):
    i = int(input())
    if i % 10 == 0:
        k10.append(i)
        s += i
    else:
        k.append(i)
k.sort()
c = np.array(k)
l = c.sum()
if l%10==0 and len(k) !=0:
    l = l - c[0]
    s = s + l
elif:len(k) == 0
    s = 0
else:
    s = s + l
print(s)

### FIXED CODE ###

#C Bugged
import numpy as np
a = int(input())
k   = []
k10 = []
s = 0

for j in range(a):
    i = int(input())
    if i % 10 == 0:
        k10.append(i)
        s += i
    else:
        k.append(i)
k.sort()
c = np.array(k)
l = c.sum()
if l%10==0 and len(k) !=0:
    l = l - c[0]
    s = s + l
elif len(k) == 0:
    s = 0
else:
    s = s + l
print(s)
def main():
  N = int(input())
  INF = float('inf')
  A = [(i+1, a) for i, a in enumerate(map(int, input().split()))]
  A = sorted(A, key=lambda x: x[1], reverse = True)
 
  dp = [[-INF] * (N+1) for _ in range(N+1)]
  dp[0][0] = 0
 
  for s in range(1, N+1):
    for l in range(s+1):
      r = s - l
      dp[l][r] = max(dp[l-1][r] + A[s-1][1] * abs(A[s-1][0]-l), dp[l][r-1] + A[s-1][1] * abs(N-r+1-A[s-1][0]))
    
  ans = 0
  for m in range(N):
    if(dp[m][N-m] > ans):
      ans = dp[m][N-m]
    
  print(ans)
 
main()

### FIXED CODE ###

import numpy as np
print(float(input())*2*np.pi)
N = int(input())
ans = 0
for i in range(1, n+1):
    if i%2 !=0:
        for j in range(1, i+1):
            if i%j==0:
                count+=1
            if count ==8:
                ans += 1
print(ans)

### FIXED CODE ###

n = int(input())
count = 0
for i in range(1, n+1):
    if i%3 ==0 and i%5 == 0 and i%7 ==0:
        count+=1
    
    elif i%27==0 and i%5==0:
        count+=1
    
    elif i%27==0 and i%7 ==0:
        count+=1
    elif i%3==0 and i%5==0 and i%13==0:
        count+=1
    elif i%3 ==0 and i%5==0 and i%11 ==0:
        count+=1

print(count)
import math

n ,d  = input().split()
n = int(n)
d = int(d)

for i in range(n):
    x ,y  = input().split()
    x = int(x)
    y = int(y)

    a = math.sqrt(x*x + y*y)
    
    if a <= d:
        nanko += 1

print(nanko) 


### FIXED CODE ###

import math

p = 0

n,d  = input().split()
n = int(n)
d = int(d)

for i in range(n):
    x,y  = input().split()
    x = int(x)
    y = int(y)

    a = math.sqrt(x*x + y*y)
    
    if a <= d:
        p = p + 1

print(p)
n=int(input())
a=[]
b=[]
c=[]
for i in range(n):
    d,e,f=map(int,input().split())
    a.append(d)
    b.append(e)
    c.append(f)
dp[0]=[a[0],b[0],c[0]]
for i in range(1,n):
    dp[i]=[dp[i-1][0]+max(b[i],c[i]),dp[i-1][1]+max(a[i],c[i]),dp[i-1][2]+max(b[i],a[i])]
print(max(dp[n-1]))


### FIXED CODE ###

n=int(input())
dp=[0,0,0]
for i in range(n):
    a,b,c=map(int,input().split())
    dp=[max(dp[1],dp[2])+a,max(dp[0],dp[2])+b,max(dp[0],dp[1])+c]
print(max(dp))
import math
import sympy
S = int(input())
x = int(math.ceil(math.sqrt(S)))
Z = x * x - S

if Z == 0:
    z = 0
    oz = 0
else:
    fs = sympy.factorint(Z)
    z = 1
    oz = 1
    for k in fs:
        c = fs[k]
        while c >= 2:
            z *= k
            oz *= k
            c -= 2
        if c > 0:
            if z < oz:
                z *= k
            else:
                oz *= k




print("0 0 {} {} {} {}".format(x, z, oz, x))

### FIXED CODE ###

import math
def factorize(n):
    fct = []  # prime factor
    b, e = 2, 0  # base, exponent
    while b * b <= n:
        while n % b == 0:
            n = n // b
            e = e + 1
        if e > 0:
            fct.append((b, e))
        b, e = b + 1, 0
    if n > 1:
        fct.append((n, 1))
    return fct

S = int(input())
x = int(math.ceil(math.sqrt(S)))
Z = x * x - S

if Z == 0:
    z = 0
    oz = 0
else:
    fs = factorize(Z)
    z = 1
    oz = 1
    for k, c in fs:
        while c >= 2:
            z *= k
            oz *= k
            c -= 2
        if c > 0:
            if z < oz:
                z *= k
            else:
                oz *= k




print("0 0 {} {} {} {}".format(x, z, oz, x))
def gcd(a,b):
  a,b=max(a,b),min(a,b)
  if b==0:
    return a
  else:
    return gcd(b,a%b)

n=int(input())
arr=list(map(int,input()))
for i in range(n-1):
  tmp=gcd(arr[i],arr[i+1])
print(tmp)

### FIXED CODE ###

def gcd(a,b):
  a,b=max(a,b),min(a,b)
  if b==0:
    return a
  else:
    return gcd(b,a%b)
 
n=int(input())
arr=list(map(int,input().split()))
tmp=gcd(arr[0],arr[1])
for i in range(1,n):
  tmp=gcd(tmp,arr[i])
print(tmp)
import sys

def subset(line):
    l = line.strip().split(" ")
    a = list(map(int, l))
    xy = list(map(lambda x: [x // 10, x % 10], a))
    dominos = [[1 if x != y and ([x, y] in xy or [y, x] in xy) else 0 \
                for x in range(0, 7)] for y in range(0, 7)]
    digits = []
    for i in xy:
        digits.extend(i)
    digits = list(set(digits))
    digits.sort()
    return digits, dominos

def add_matrix(a, b):
    c = [[a[j][i] + b[j][i] for i in range(0, 7)] for j in range(0, 7)]
    return c

def mul_matrix(a, b):
    c = [[0 for i in range(0, 7)] for j in range(0, 7)]
    for j in range(0, 7):
        for i in range(0, 7):
            for k in range(0, 7):
                c[j][i] += a[j][k] * b[k][i]
    return c
                
def is_connected(d, g):
    a = g[:]
    z = [[0 for i in range(0, 7)] for j in range(0, 7)]
    b = a
    for i in range(0, 7):
        z = add_matrix(z, b)
        b = mul_matrix(b, a)
    zeros = 0
    for i in d:
        if z[d[0]][i] == 0:
            zeros += 1
    return zeros == 0
        
lno = 0
for line in sys.stdin:
    lno += 1
    if lno == 1:
        n = int(line)
    else:
        digits, dominos = subset(line)
        if not is_connected(digits, dominos):
            print("No")
        else:
            order = np.sum(dominos, axis = 0)
            order = order % 2
            if np.all(order == 0):
                print("Yes")
            elif len(order[order == 1]) <= 2:
                print("Yes")
            else:
                print("No")
        lno = 0


### FIXED CODE ###

import sys

def subset(line):
    l = line.strip().split(" ")
    a = list(map(int, l))
    xy = list(map(lambda x: [x // 10, x % 10], a))
    dominos = [[2 if [x, y] in xy and x == y else \
                1 if [x, y] in xy else \
                1 if [y, x] in xy else 0 \
                for x in range(0, 7)] for y in range(0, 7)] 
    digits = []
    for i in xy:
        digits.extend(i)
    digits = list(set(digits))
    digits.sort()
    return digits, dominos

def add_matrix(a, b):
    c = [[a[j][i] + b[j][i] for i in range(0, 7)] for j in range(0, 7)]
    return c

def mul_matrix(a, b):
    c = [[0 for i in range(0, 7)] for j in range(0, 7)]
    for j in range(0, 7):
        for i in range(0, 7):
            for k in range(0, 7):
                c[j][i] += a[j][k] * b[k][i]
    return c
                
def is_connected(d, g):
    a = g[:]
    z = [[0 for i in range(0, 7)] for j in range(0, 7)]
    b = a
    for i in range(0, 7):
        z = add_matrix(z, b)
        b = mul_matrix(b, a)
    zeros = 0
    for i in d:
        if z[d[0]][i] == 0:
            zeros += 1
    return zeros == 0
        
lno = 0
for line in sys.stdin:
    lno += 1
    if lno == 1:
        n = int(line)
    else:
        digits, dominos = subset(line)
        if not is_connected(digits, dominos):
            print("No")
        else:
            order = [sum(dominos[i]) for i in range(0, 7)]
            odd = 0
            for i in digits:
                if order[i] % 2 != 0:
                    odd += 1
            if odd <= 2:
                print("Yes")
            else:
                print("No")
        lno = 0
a,b,c,d,e = [int(input()) for i in range(5)]
count = a + b + c + d + e
l = [a%10,b%10,c%10,d%10,e%10]
s = [a%10,b%10,c%10,d%10,e%10]
m = [a%10,b%10,c%10,d%10,e%10]
for x in range(len(l)):
    if l[x] == 0:
        m.remove(0)
for i in range (len(s)):
    count = count -s[i]
ans = count + 10*len(m) + min(m) -10
print(ans)

### FIXED CODE ###

a,b,c,d,e = [int(input()) for i in range(5)]
count = a + b + c + d + e
l = [a%10,b%10,c%10,d%10,e%10]
s = [a%10,b%10,c%10,d%10,e%10]
m = [a%10,b%10,c%10,d%10,e%10]
for x in range(len(l)):
    if l[x] == 0:
        m.remove(0)
for i in range (len(s)):
    count = count -s[i]
if len(m) == 0:
    ans= count
    print(ans)
else:
    ans = count + 10*len(m) + min(m) -10
    print(ans)