#include <iostream>
using namespace std;

class A{
public:
    int d[5];
    int min = 0;
    A();
    void decade();
    int jikan();
    int hantei();
};

A::A(){
    int r = 0;
    for (int i = 0; i < 5; i++)
        cin >> d[i];
    for (int i = 0; i < 5; i++) {
        if (min > d[i]) {
            min = d[i];
            r = i;
        }
    }
    d[r] = 0;
}


void A::decade() {
    for (int i = 0; i < 5; i++) {
        if (d[i] % 10)
            d[i] += (10 - d[i] % 10);
    }
}

int hantei() {
    int kekka = 0;
    for (int i = 0; i < 5; i++)
        kekka += d[i];
    kekka += min;
    return kekka; 
}

int main() {
    A str;
    cout << str.hantei() << endl;
    return (0);
}