data_ = [int(input()) for i in range(5)]

sum_ = 0
min_ = (data_[0]-1)%10
for i in range(5):
    sum_ += ((data_[i]+9)//10)*10
    min_ = min([(data_[i]-1)%10,min_])
    
print(sum_) if min_==0 else print(sum_-10+min_+1)