import sys
input = sys.stdin.readline

def main():
    A = int(input())
    B = int(input())
    C = int(input())
    D = int(input())
    E = int(input())

    ans = 0
    mi = float("inf")

    if A % 10 != 0:
        mi = min(mi, A % 10)
    if B % 10 != 0:
        mi = min(mi, B % 10)
    if C % 10 != 0:
        mi = min(mi, C % 10)
    if D % 10 != 0:
        mi = min(mi, D % 10)
    if E % 10 != 0:
        mi = min(mi, E % 10)

    ans += (-(-A // 10)) * 10
    ans += (-(-B // 10)) * 10
    ans += (-(-C // 10)) * 10
    ans += (-(-D // 10)) * 10
    ans += (-(-E // 10)) * 10

    print(ans - (10 - mi))



if __name__ == '__main__':
    main()

