#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> v(5);
  vector<int> a(5);
  for (int i = 0; i < (int)(5); i++) {
    cin >> v[i];
    a[i] = v[i] % 10;
  }
  int mn = 10000;
  int x = 0;
  for (int i = 0; i < (int)(5); i++) {
    if (a[i] != 0 && min(mn, a[i]) == a[i]) {
      mn = min(mn, a[i]);
      x = i;
    }
  }
  int sum = 0;
  for (int i = 0; i < (int)(5); i++) {
    if (i != x)
      sum += (v[i] / 10 + 1) * 10;
    else
      sum += v[i];
  }
  cout << sum << endl;
  return 0;
}
