# -*- coding: utf-8 -*-

import math

li = []
for i in range(5):
    li.append(int(input()))

s = 0
for f in li:
    s += (f//10)*10 + 10*(int(bool(f%10)))

li2 = []
for f in li:
    if f%10 != 0:
        li2.append(f%10)

print(s + min(li2) - 10)