a=[0]*5
for i in range(5):
    a[i]=int(input())
ha=10
for i in range(5):
    if a[i]%10!=0:
        ha=min(ha,a[i]%10)
ans=0
for i in range(5):
    if a[1]%10==0:
        ans+=a[i]
    else:
        ans+=a[i]+(10-a[i]%10)
print(ans-(10-ha))