#include <iostream>
#include <vector>
using namespace std;

int main()
{
  vector<int> v(5);
  for (int i = 0; i < 5; i++) {
    cin >> v[i];
  }
  sort(begin(v), end(v), [](auto a, auto b){return a % 10 < b % 10;});
  int ans = 0;
  int r = 10;
  for (int i = 0; i < 5; i++) {
    if (v[i] % 10 != 0) {
      r = min(r, v[i] % 10);
    }
    ans += (v[i] + 9) / 10 * 10;
  }
  if (r != 10) {
    ans = ans - 10 + r;
  }
  cout << ans << endl;
}
