import numpy as np

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


max_=0
for h in ls:
    if h%10 == 0:
        pass
    else:
        re =10-h
        if re>=max_:
            max_ = re

time = 0
for i in ls:
    if i%10 == 0:
        time += i
    else:
        time += (i//10+1)*10

time -= re

print(time)
