#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> a(5);
  int sum = 0;
  for (int i = 0; i < 5; i++) {
    cin >> a[i];
    sum += a[i];
    a[i] %= 10;
  }
  sort(a.begin(), a.end());
  for (int i = 0; i < 4; i++) {
    sum += 10 - (a[i] % 10);
  }
  cout << sum << endl;
}
