#include <bits/stdc++.h>
using namespace std;
int dy[] = {0, 0, 1, -1};
int dx[] = {
    1,
    -1,
    0,
    0,
};
int main() {
  vector<long long> a(5);
  for (long long i = 0; i < 5; i++) {
    cin >> a[i];
  }
  long long ans = 0;
  long long res = 9;
  for (long long i = 0; i < 5; i++) {
    ans += (a[i] - 1) / 10 * 10 + 10;
    res = min(res, (a[i] - 1) % 10);
  }
  cout << ans + (res + 1) % 10 - 10 << endl;
}
