#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import math


def main():
    ABCDE = [int(input()) for _ in range(5)]
    result = 0
    m = 10
    for i in ABCDE:
        result += math.ceil(i / 10) * 10
        if i % 10 != 0:
            m = min(m, i % 10)
    print(result + m % 10 - 10)


if __name__ == "__main__":
    main()
