#n=int(input())
#li=input().split()
#d=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
#import numpy as np
#import math
#li=list(map(int,input().split()))
#S=input()

lis=[[],[]]
for i in range(5):
    s=int(input())
    lis[0].append(s)
    lis[1].append(s%10)
for i in range(5):
    if lis[1][i]!=0:
        m=i
        break
for i in range(5):
    if lis[1][m]>lis[1][i] and lis[1][i]!=0:
        m=i
ans=0
for i in range(5):
    if i!=m:
        if lis[1][i]!=0:
            ans+=(lis[0][i]-lis[1][i]+10)
        else:
            ans+=lis[0][i]
ans+=lis[0][m]
print(ans)
