#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long int a[5];
  for (long long int i = 0; i < 5; i++) {
    cin >> a[i];
  }
  long long int result = 0;
  sort(a, a + 5,
       [](long long int a, long long int b) { return a % 10 < b % 10; });
  for (long long int i = 0; i < 5; i++) {
    result += a[i] % 10 == 0 ? a[i] : a[i] + (10 - (a[i] % 10));
  }
  cout << result << endl;
}
