#include <bits/stdc++.h>
#include <numeric>
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

int ord(int x){
    return (x+9)/10*10;
}

int time(int x){
    return ord(x)-x;
}

int main(){
    int a,b,c,d,e;
    cin >> a >> b >> c >> d >> e;
    int sum=ord(a)+ord(b)+ord(c)+ord(d)+ord(e);
    sum-=max(time(a),time(b),time(c),time(d),time(e));
    cout << sum << endl;
}
