#include <bits/stdc++.h>
using namespace std;
int a[5];
int main() {
  for (int i = 0; i < 5; i++) cin >> a[i];
  int c = 0, d = 1000000007;
  for (int i = 0; i < 5; i++) {
    c += (a[i] / 10 + !!(a[i] % 10)) * 10;
    if (a[i] % 10) {
      d = min(d, a[i] % 10);
    }
  }
  cout << c - 10 + (d == 1000000007 ? 0 : d) << endl;
  return 0;
}
