#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c, d, e;
  cin >> a >> b >> c >> d >> e;
  int x = max((10 - a) % 10,
              min((10 - b) % 10,
                  min((10 - c) % 10, min((10 - d) % 10, (10 - e) % 10))));
  while (a % 10 != 0) a++;
  while (b % 10 != 0) b++;
  while (c % 10 != 0) c++;
  while (d % 10 != 0) d++;
  while (e % 10 != 0) e++;
  cout << a + b + c + d + e - x - 10 << endl;
}
