#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<long long int> a(5);
  for (long long int i = 0; i < 5; i++) {
    cin >> a[i];
  }
  long long int m = INT_MAX, pos, c;
  for (long long int i = 0; i < 5; i++) {
    long long int k = a[i] % 10;
    if (k == 0)
      continue;
    else {
      if (k < m) {
        m = k;
        pos = a[i];
        c = i;
      }
    }
  }
  long long int sum = pos;
  a.erase(a.begin() + c);
  for (long long int i = 0; i < 4; i++) {
    if (a[i] % 10 == 0) {
      sum = sum + a[i];
    } else {
      sum = sum + (((a[i] / 10) + 1) * 10);
    }
  }
  cout << sum << endl;
  return 0;
}
