#include <bits/stdc++.h>
using namespace std;
vector<int> v;
int set(int food) {
  v.push_back(10 - food % 10);
  int r = food + (10 - food % 10);
  return r;
}
int main() {
  int a, b, c, d, e;
  cin >> a >> b >> c >> d >> e;
  if (a % 10 != 0) {
    a = set(a);
  }
  if (b % 10 != 0) {
    b = set(b);
  }
  if (c % 10 != 0) {
    c = set(c);
  }
  if (d % 10 != 0) {
    d = set(d);
  }
  if (e % 10 != 0) {
    e = set(e);
  }
  int maxv = *max_element(v.begin(), v.end());
  cout << a + b + c + d + e - maxv << endl;
  return 0;
}
