#! /usr/bin/env python3
# -*- coding: utf-8 -*-
ls = []
for i in range(5):
    ls.append(int(input()))

lasttime = 10
for a in ls:
    b = a%10
    if b < lasttime and b != 0:
        lasttime = b
        ans =a

ls.remove(ans)
sum =0
for i in ls:
    if i%10 ==0:
        sum +=i
    else:
        p = i//10
        sum += (p+1)*10

print(int(sum + ans))

