#include <bits/stdc++.h>
using namespace std;
class A {
  int d[5];
  int min;
  int diff;

 public:
  A();
  void decade();
  int hantei();
};
A::A() {
  for (int i = 0; i < 5; i++) {
    cin >> d[i];
    if (d[i] % 10) min = d[i];
  }
  for (int i = 0; i < 5; i++) {
    if (((min % 10) > (d[i] % 10)) && (d[i] % 10)) min = d[i];
  }
  diff = 10 - (min % 10);
  for (int i = 0; i < 5; i++) {
    if (d[i] % 10) d[i] += 10 - (d[i] % 10);
  }
}
int A::hantei() {
  int kekka = 0;
  for (int i = 0; i < 5; i++) kekka += d[i];
  kekka -= min;
  return kekka;
}
int main() {
  A kurasu;
  cout << kurasu.hantei() << endl;
  return (0);
}
