#!/usr/bin/env python

from collections import deque
import itertools as it
import sys
import math

sys.setrecursionlimit(1000000)

INF = 10 ** 18
MOD = 10 ** 9 + 7

ans = 0
rem = 10
for i in [0] * 5:
    N = input()
    if N % 10 != 0:
        ans += N / 10 * 10 + 10
        rem = min(rem, N % 10)
    else:
        ans += N

ans -= 10
ans += rem
print ans