from collections import defaultdict,deque

import sys,heapq,bisect,math,itertools,string,queue,datetime,random

sys.setrecursionlimit(10**8)

INF = float('inf')

mod = 10**9+7

eps = 10**-7

def inpl(): return list(map(int, input().split()))

def inpls(): return list(input().split())



aa = [int(eval(input())) for _ in range(5)]

ans = 0

tmp = INF

for a in aa:

    ans += (a-1)//10 * 10 + 10

    tmp = min(tmp,(a-1)%10+1)



print((ans+tmp-10))

from collections import defaultdict

import sys,heapq,bisect,math,itertools,string,queue,datetime

sys.setrecursionlimit(10**8)

INF = float('inf')

mod = 10**9+7

eps = 10**-7

def inpl(): return list(map(int, input().split()))

def inpl_str(): return list(input().split())



order = [int(eval(input())) for _ in range(5)]

ans = 0

last = INF

for i in range(5):

    ans += ((order[i]-1)//10+1) * 10

    last = min(last,(order[i]-1)%10+1)



print((ans-10+last))

from collections import defaultdict, deque
import sys, heapq, bisect, math, itertools, string, queue, datetime, random

sys.setrecursionlimit(10**8)
INF = float("inf")
mod = 10**9 + 7
eps = 10**-7


def inpl():
    return list(map(int, input().split()))


def inpls():
    return list(input().split())


aa = [int(eval(input())) for _ in range(5)]
ans = 0
tmp = INF
for a in aa:
    ans += (a - 1) // 10 * 10 + 10
    tmp = min(tmp, (a - 1) % 10 + 1)
print((ans + tmp - 10))

from collections import defaultdict
import sys, heapq, bisect, math, itertools, string, queue, datetime

sys.setrecursionlimit(10**8)
INF = float("inf")
mod = 10**9 + 7
eps = 10**-7


def inpl():
    return list(map(int, input().split()))


def inpl_str():
    return list(input().split())


order = [int(eval(input())) for _ in range(5)]
ans = 0
last = INF
for i in range(5):
    ans += ((order[i] - 1) // 10 + 1) * 10
    last = min(last, (order[i] - 1) % 10 + 1)
print((ans - 10 + last))

-from collections import defaultdict, deque -import sys, heapq, bisect, math, itertools, string, queue, datetime, random +from collections import defaultdict +import sys, heapq, bisect, math, itertools, string, queue, datetime -def inpls(): +def inpl_str(): -aa = [int(eval(input())) for _ in range(5)] +order = [int(eval(input())) for _ in range(5)] -tmp = INF -for a in aa: -    ans += (a - 1) // 10 * 10 + 10 -    tmp = min(tmp, (a - 1) % 10 + 1) -print((ans + tmp - 10)) +last = INF +for i in range(5): +    ans += ((order[i] - 1) // 10 + 1) * 10 +    last = min(last, (order[i] - 1) % 10 + 1) +print((ans - 10 + last))