#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
const long long LINF = 1e18;
const int MOD = 1e9 + 7;
int main() {
  vector<int> v(5);
  int minN = INF;
  for (int i = 0; i < 5; i++) {
    cin >> v[i];
    if (v[i] % 10 != 0) minN = min(minN, v[i] % 10);
    v[i] = ((v[i] + 9) / 10) * 10;
  }
  cout << accumulate((v).begin(), (v).end(), 0) - 10 + minN << endl;
}
