#include <bits/stdc++.h>
using namespace std;
signed main(void) {
  vector<int> v(5), s(5);
  pair<int, int> tmp;
  int now;
  tmp.first = tmp.second = 10;
  for (int i = 0; i < 5; i++) {
    cin >> v.at(i);
    if (v[i] % 10 != 0) {
      if (tmp.first > v[i] % 10) {
        tmp.first = v[i] % 10;
        tmp.second = i;
      }
    }
  }
  swap(v.at(tmp.second), v.at(4));
  now = v.at(0);
  for (int i = 0; i < 4; i++) {
    if (now % 10 != 0) now += (10 - now % 10);
    now += v.at(i + 1);
  }
  cout << now << endl;
  return 0;
}
