#include <iostream>
#include <vector>
#include <algorithm>

int main()
{
    std::vector<int> D(5);
    std::vector<int> W(5);
    std::vector<int, int> DISH;
    int ans = 0;
    int d;
    for (int i = 0; i < 5; i++) {
        std::cin >> d;
        DISH.push_back(std::make_pair(10-d%10, d));
    }

    std::sort(std::begin(DISH), std::end(DISH));
    for (int i = 0; i < 5; i++) {
        ans += DISH[i].second;
        if (i != 4) {
            if (ans%10!=0) {
                ans += (ans%10);
            }
        }
    }

    std::cout << ans << std::endl;

    return 0;
}