import numpy as np
A, B, C, D, E = [int(input()) for i in range(5)]

x = np.array([A, B, C, D, E])
ans = int((np.ceil((x / 10)) * 10).sum())
x = x %10
tmp = 10 - x[np.where(x>0)].min()
ans = ans - tmp

print(ans)