#!/usr/bin/env python3
import sys, math, itertools, heapq, collections, bisect, string
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
sys.setrecursionlimit(10**7)
inf = float('inf')
mod = 10**9+7
ans = inf ;count = 0 ;pro = 1



A=[int(input()) for i in range(5)]
ans=-10;candi=inf
for ai in A:
    ans+=math.ceil(ai/10)*10
    if ai%10!=0:
        candi=min(candi,ai%10)
print(ans+candi if not candi==inf else ans)
