#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[5], b[5];
  int last = (1e9);
  int mem1, mem2, sum = 0;
  for (int i = 0; i < 5; i++) {
    cin >> a[i];
    b[i] = a[i] % 10;
    if (b[i] != 0) {
      if (last >= b[i]) {
        last = b[i];
        mem1 = a[i];
        mem2 = i;
      }
      a[i] = (a[i] / 10) + 1;
      a[i] = a[i] * 10;
    }
    sum += a[i];
  }
  if (last = (1e9)) {
    cout << sum << endl;
    return 0;
  }
  sum -= a[mem2];
  sum += mem1;
  cout << sum << endl;
}
