#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <utility>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
using P pair<int, int>;

int abc[5];

int main(){
    rep(i, n) cin >> abc[i];
    int n = 5;

    vector<int> nexttime(n);
    rep(i, n) {
        nexttime[i] = (abc[i] + 9) / 10 * 10;
    }
    int besttime = 999999;
    rep(i, n) {
        int sumtime = 0;
        for (int j; j < n; j++) {
            if (i == j) sumtime += abc[i];
            else {
                sumtime += nexttime[i];
            }
        }
        besttime = min(besttime, sumtime);

    }
    cout << besttime << endl;

}
   