Problem:


Score: 200 points

Problem Statement

The restaurant AtCoder serves the following five dishes:

ABC Don (rice bowl): takes A minutes to serve.

ARC Curry: takes B minutes to serve.

AGC Pasta: takes C minutes to serve.

APC Ramen: takes D minutes to serve.

ATC Hanbagu (hamburger patty): takes E minutes to serve.

Here, the time to serve a dish is the time between when an order is placed and when the dish is delivered.

This restaurant has the following rules on orders:

An order can only be placed at a time that is a multiple of 10 (time 0, 10, 20, ...).

Only one dish can be ordered at a time.

No new order can be placed when an order is already placed and the dish is still not delivered, but a new order can be placed at the exact time when the dish is delivered.

E869120 arrives at this restaurant at time 0. He will order all five dishes. Find the earliest possible time for the last dish to be delivered.

Here, he can order the dishes in any order he likes, and he can place an order already at time 0.

Constraints

A, B, C, D and E are integers between 1 and 123 (inclusive).

Input

Input is given from Standard Input in the following format:

A
B
C
D
E

Output

Print the earliest possible time for the last dish to be delivered, as an integer.

Sample Input 1

29
20
7
35
120

Sample Output 1

215

If we decide to order the dishes in the order ABC Don, ARC Curry, AGC Pasta, ATC Hanbagu, APC Ramen, the earliest possible time for each order is as follows:

Order ABC Don at time 0, which will be delivered at time 29.

Order ARC Curry at time 30, which will be delivered at time 50.

Order AGC Pasta at time 50, which will be delivered at time 57.

Order ATC Hanbagu at time 60, which will be delivered at time 180.

Order APC Ramen at time 180, which will be delivered at time 215.

There is no way to order the dishes in which the last dish will be delivered earlier than this.

Sample Input 2

101
86
119
108
57

Sample Output 2

481

If we decide to order the dishes in the order AGC Pasta, ARC Curry, ATC Hanbagu, APC Ramen, ABC Don, the earliest possible time for each order is as follows:

Order AGC Pasta at time 0, which will be delivered at time 119.

Order ARC Curry at time 120, which will be delivered at time 206.

Order ATC Hanbagu at time 210, which will be delivered at time 267.

Order APC Ramen at time 270, which will be delivered at time 378.

Order ABC Don at time 380, which will be delivered at time 481.

There is no way to order the dishes in which the last dish will be delivered earlier than this.

Sample Input 3

123
123
123
123
123

Sample Output 3

643

This is the largest valid case.



Sample input:
29
20
7
35
120


Sample output:
215

Submission status: Runtime Error

Solution code:
ans = 0
a = []
for _ in range(5):
    x = int(input())
    if x%10 == 0:
        ans += x
    else:
        ans += (x//10)*10
        a.append(x%10)

ans += (len(a)-1)*10
ans += min(a)

print(ans)

Submission status: Runtime Error

Solution code:
a = [int(input()) for i in range(5)]
A = []
for i in range(5):
    if a[i]%10!=0:
        A.append(10-a[i]%10)
        a[i] += 10-a[i]%10

A.sort()
print(sum(a)-A[-1])

Submission status: Runtime Error

Solution code:
total = 0
c = []
for i in range(5):
    a = input()
    b = int(a)
    if int(a[-1]) != 0:
        c.append(int(a[-1]))
        total += b - int(a[-1]) + 10
    else:
        total += b

total += min(c)
total -= 10
print(total)

Submission status: Runtime Error

Solution code:
A=[]

for i in range(5):
    A.append(int(input()))

m=10

for i in range(5):
    if A[i]%10<m and A[i]%10!=0:
        m=A[i]%10
        s=i

su=0

for i in range(5):
    if i==s:
        su+=A[i]
    elif A[i]%10!=0:
        su+=(A[i]//10+1)*10
    else:
        su+=A[i]
print(su)

Submission status: Runtime Error

Solution code:
a=[]
b=[]
for i in range(5):
    buf = int(input())
    a.append(buf)
    if buf%10 != 0:
        b.append(10-buf%10)
print(sum(a)+sum(b)-max(b))

Submission status: Runtime Error

Solution code:
AE = []
for i in range(5):
    AE.append(int(input()))

ans = 0
mini = []
for i in AE:
    if(i%10 == 0):
        ans += i
    else:
        ans += (i//10 + 1)*10
        mini.append(i%10)
print(ans + min(mini) - 10)

Submission status: Runtime Error

Solution code:
L=[]
L2=[]
for i in range(5):
    I=int(input())
    L.append(I)
    L2.append(I%10)

result=0
for i in L:
    result+=i
    if result%10==0:
        continue
    for j in range(10):
        result+=1
        if result%10==0:
            break

if min(L2)==0:
    for t in sorted(L2):
        if t==0:
            pass
        else:
            mn=t
            break
else:
    mn=min(L2)

print(result-(10-mn))

Submission status: Runtime Error

Solution code:
dish = []
time = 0
for i in range(5):
    temp = int(input())
    if temp % 10:
        dish.append(temp)
    else:
        time += temp
left = 10 - min([x % 10 for x in dish])
for i in range(len(dish)):
    dish[i] = dish[i] + 10 - dish[i] % 10
time = time + sum(dish) - left
print(time)

Submission status: Runtime Error

Solution code:
menu = [int(input()) for _ in range(5)]

cnt = 0
l = []
for m in menu:
  cnt += m
  mod = cnt % 10
  if mod != 0:
    cnt += 10 - mod
    l.append(mod)

if l.count != 0:
  cnt -= 10 - min(l)
print(cnt)

Submission status: Runtime Error

Solution code:
ans = 0
used = False
mins = [int(input()) for _ in range(5)]
m = min(map(lambda x:(x%10, x), filter(lambda x:x%10, mins)))
for menu in mins:
  if used==False and menu==m[1]:
    continue
  ans += (menu//10)*10 + 10*(menu%10>0)
print(ans + m[1])

Submission status: Runtime Error

Solution code:
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
tmp = 9
for i in [A, B, C, D, E]:
    if i % 10 == 0:
        continue
    else:
        if i % 10 < tmp:
            tmp = i % 10
            last = i

ans = 0
for i in [A, B, C, D, E]:
    if i % 10 == 0:
        ans += i
    else:
        ans += i + (10-i%10)

print(ans-(10-last%10))

Submission status: Runtime Error

Solution code:
A = list(int(input()) for _ in range(5))
B = []
for i in range(5):
    if A[i] % 10 != 0:
        
        B.append(10 - A[i] % 10)
B.remove(max(B))
print(sum(A) + sum(B))

Submission status: Runtime Error

Solution code:
menu = [int(input()) for _ in range(5)]

cnt = 0
l = []
for m in menu:
  cnt += m
  mod = cnt % 10
  if mod != 0:
    cnt += 10 - mod
    l.append(mod)

cnt -= 10 - min(l)
print(cnt)

Submission status: Runtime Error

Solution code:
import sys
dishes = [int(input()) for _ in range(5)]
min_ = min([(d%10,d) for d in dishes if d%10>0])

ans = min_[1]
dishes.remove(min_[1])
for d in dishes:
    if d%10==0:
        ans += d
    else:
        ans += (d//10+1)*10
print(ans)

Submission status: Runtime Error

Solution code:
A = [0] * 5
for i in range(5):
  A[i] = int(input())
A.sort(reversed=True, key=lambda x: x % 10)
t = 0
for a in A[:4]:
  a += 9
  t += a - a % 10
print(t + a[4])

Submission status: Runtime Error

Solution code:
import sys
input = sys.stdin.readline
a = [0,0,0,0,0]
b = [[0,i] for i in range(5)]
for i in range(5):
    a[i] = int(input())
    b[i][0] = a[i] % 10
b.sort()
j = 0
while b[j][0] == 0:
    j += 1
time = 0
for i in range(5):
    if i != b[j][1]:
        if a[i] % 10 == 0:
            time += a[i]
        else:
            time += (a[i] + (10 - a[i] % 10))
time += a[b[j][1]]
print(time)

Submission status: Runtime Error

Solution code:
times = [int(input()) for _ in range(5)]
times1 = []
total = 0
for t in times:
  t1 = t % 10
  if t1 == 0:
    total += t
  else:
    times1.append(t1)
    total += (t//10 + 1) * 10
if len(times) >= 1:
    total = total + min(times1) - 10
print(total)

Submission status: Runtime Error

Solution code:
ls = []

for i in range(5):
    ls.append(int(input()))
sum = 0
ls1 = []
for i in range(5):
    if ls[i] % 10 == 0:
        sum += ls[i]
    else:
        ls1.append(10 - ls[i] % 10)
        sum += (ls[i] // 10 + 1 )* 10
#print(ls1)
print(sum - max(ls1))

Submission status: Runtime Error

Solution code:
times = []
ones = []
for i in range(5):
    t = int(input())
    times.append((t + 9) // 10 * 10)
    ones.append(t % 10)
ones.sort()
print(sum(times) - 10 + min(filter(lambda x: x, ones)))

Submission status: Runtime Error

Solution code:
num = [int(input()) for _ in range(5)]

ans = 0
flag = 0
for i in num:
    if i % 10 == 0:
        ans += i
    else:
        ans += i // 10 * 10 + 10
        flag = 1

if flag:
    ma = 0
    for i in num:
        if i % 10 == 0:
            continue
        ma = max(ma, 10 - i % 10)

print(ans - ma)

Submission status: Runtime Error

Solution code:
a,b,c,d,e=int(input())
print(a)

Submission status: Runtime Error

Solution code:
a,b,c,d,e=int(input())

Submission status: Runtime Error

Solution code:
import math
ABCDE = [int(input()) for _ in range(5)]
print(
    sum([10 * math.ceil(_ / 10)
         for _ in ABCDE]) + min([_ % 10 for _ in ABCDE if _ % 10]) - 10)

Submission status: Runtime Error

Solution code:
a = []
for i in range(6):
    a.append(int(input()))
    
result = 0
for each in a:
    if each % 10 != 0:
        result += each + 10 - (each % 10)
    else:
        result += each
print(result)

Submission status: Runtime Error

Solution code:
A = [int(input()) for _ in range(5)]

y = min([x%10 for x in A if x%10])

print(sum([10*(x//10 + bool(x%10)) for x in A]) -10 + y)