a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())

m0=a%10
m1=b%10
m2=c%10
m3=d%10
m4=e%10

li=[a,b,c,d,e]
lis=[m0,m1,m2,m3,m4]

x=lis.index(max(lis))
y=li[x]

li[x]=0

sum=li[0]

mod= sum % 10

if mod!=0:
    sum=sum+(10-mod)

sum=sum+ li[1]

mod= sum % 10

if mod!=0:
    sum=sum+(10-mod)

sum=sum+ li[2]

mod= sum % 10

if mod!=0:
    sum=sum+(10-mod)

sum=sum+ li[3]

mod= sum % 10

if mod!=0:
    sum=sum+(10-mod)

sum=sum+ li[4]

mod= sum % 10

if mod!=0:
    sum=sum+(10-mod)

sum=sum+y


print(sum)