#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  vector<int> a(5);
  for (int i = 0; i < (int)(5); i++) {
    cin >> a[i];
  }
  int last = 9;
  int index;
  for (int i = 0; i < (int)(5); i++) {
    if (a[i] % 10 != 0) {
      int s = a[i] % 10;
      last = min(last, s);
      a[i] -= s;
      a[i] += 10;
    }
  }
  int total = 0;
  for (int i = 0; i < (int)(5); i++) {
    total += a[i];
  }
  total = total - 10 + last;
  cout << total << endl;
  return 0;
}
