#include <bits/stdc++.h>
using namespace std;
vector<int> v;
void load(int a) {
  if (a % 10 != 0) v.push_back(10 - (a % 10));
}
int main() {
  int a, b, c, d, e;
  scanf("%d", &a);
  load(a);
  scanf("%d", &b);
  load(b);
  scanf("%d", &c);
  load(c);
  scanf("%d", &d);
  load(d);
  scanf("%d", &e);
  load(e);
  sort(v.begin(), v.end());
  int res = 0;
  for (int i = 0; i < v.size() - 1; ++i) {
    res += v[i];
  }
  cout << a + b + c + d + e + res;
  return 0;
}
