#include <bits/stdc++.h>
using namespace std;
int main() {
  int s = 0, a[5];
  for (int i = 0; i < 5; ++i) {
    cin >> a[i];
    if (i) {
      if (a[i] % 10 > a[i - 1] % 10 && a[i - 1]) swap(a[i], a[i - 1]);
    }
  }
  for (int i = 0; i < 5; ++i) {
    if (a[i] % 10) a[i] += 10;
    if (i == 4)
      s += a[i];
    else
      s += (a[i] / 10) * 10;
  }
  cout << s << endl;
  return 0;
}
