def main():
    time = []
    ans = 0
    min_time = 10
    for i in range(5):
        time.append(int(raw_input()))
    for i in time:
        if i%10 == 0:
            ans += i
        else:
            ans += ((i//10)+1)*10
            min_time =min(min_time,i%10)
    print(ans + min_time - 10)



if __name__ == "__main__":
    main()
