import numpy as np

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

ar = np.array(ls)

ar_ = 10 -ar

ti = max(ar_)

time = 0 

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

time -= ti

print(time)
