# coding: utf-8
import math


def main():
    li = sorted([int(input()) for _ in range(5)],
                key=lambda i: i % 10)
    s = 0
    idx = -1
    for i, el in enumerate(li):
        if idx == -1 and el % 10 > 0:
            idx = i
            continue
        s += math.ceil(el/10) * 10
    s += li[idx]
    print(s)


main()