#include <iostream>
#include <algorithm>
#include <array>

int main() {
    using namespace std;
    std::array<int, 5> dishes;
    int sum = 0;
    cin >> dishes[0] >> dishes[1] >> dishes[2] >> dishes[3] >> dishes[4];
    for(auto& dish : dishes) {
        sum += static_cast<int>(dish / 10) * 10;
        dish = (dish % 10) == 0 ? 0 : 10 - (dish % 10);
    }
    sum -= max(dishes.begin(), dishes.end());
    cin << sum;
}