#include <bits/stdc++.h>
using namespace std;
const long double PI = acos(-1.0);
int main() {
  int x[5];
  for (long long i = 0; i < (long long)(5); i++) cin >> x[i];
  int min = 9, sum = 0;
  for (long long i = 0; i < (long long)(5); i++) {
    min = (min > ((x[i] + 10) % 10 == 0 ? 10 : (x[i] + 10) % 10)
               ? ((x[i] + 10) % 10 == 0 ? 10 : (x[i] + 10) % 10)
               : min);
    sum += (x[i] % 10 == 0 ? x[i] : 10 * (x[i] / 10) + 10);
  }
  sum -= (10 - min);
  cout << sum << endl;
  return 0;
}
