#!/usr/bin/env python
import math

A = [input() for i in range(5)]
min = 9
min_dish = ''
for a in A:
    if int(a[-1]) < min and int(a[-1]) != 0:
        min = int(a[-1])
        min_dish = a
sum = int(min_dish)
A.remove(min_dish)
for a in A:
    if a[-1] == '0':
        sum += int(a)
    else:
        sum += int(a) + 10 - int(a[-1])
print(int(sum))