def main():
    x = [int(input()) for _ in range(5)]
    d = min(((i % 10, i) for i in x if i % 10 != 0), key=lambda x: x[0])
    i = x.index(d[1])
    t = 0
    for idx, v in enumerate(x):
        if idx == i or v % 10 == 0:
            t += v
        else:
            t += v + 10 - (v % 10)
        #print(idx, t)
    print(t)
    
if __name__ == "__main__":
    main()