#include <iostream>

int main() {
    int ans = 0, rem = 10;
    for (int i = 0; i < 5; ++i) {
        int A;
        std::cin >> A;
        ans += (A + 9) / 10 * 10;
        rem = std::min(rem, (A - 1) % 10 + 1);
    }
    std::cout << ans - 10 + rem << std::endl;
    return 0;
}