#include <bits/stdc++.h>
using namespace std;
int gaus(int x) {
  if (x % 10 == 0) {
    return x;
  } else {
    return x + (10 - x % 10);
  }
}
int abs(int x, int y) {
  if (x < y) {
    return y - x;
  } else {
    return x - y;
  }
}
int main() {
  vector<int> unko(5);
  for (int i = 0; i < 5; i++) {
    cin >> unko.at(i);
  }
  int last = unko.at(4);
  for (int i = 0; i < 4; i++) {
    for (int j = i + 1; j < 5; j++) {
      if (min(unko.at(i) % 10, unko.at(j) % 10) != 0) {
        if (min(unko.at(i) % 10, unko.at(j) % 10) <= last) {
          last = min(unko.at(i) % 10, unko.at(j) % 10);
        }
      }
    }
  }
  int answer = 0;
  for (int i = 0; i < 5; i++) {
    answer += gaus(unko.at(i));
  }
  cout << answer - 10 + last << endl;
}
