#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
using namespace std;
#define rep(i,x) for(int i = 0; i < x; i++)
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>> vvvi;
const ll MOD = 1e9+7;
const int n_max = 1e5+10;


int main(){
    vector<int> price(5)
    rep(i,5)cin >> price[i];
    int res = INT_MAX;
    sort(price.begin(), price.end());
    do{
        int temp = 0;
        rep(i,4){
            temp = price[i];
            temp = ceil(temp / 10.0) * 10;
        }
        temp += price[5];
        res = min(res, temp);
    }while(next_permutation(price.begin(), price.end()));
    cout << res << endl;
    return 0;
}