#include <bits/stdc++.h>
using namespace std;
const int INF = 1001001001;
const int mINF = -1001001001;
int main() {
  int a[5];
  int ans = 0;
  int a_max = 0;
  for (int i = 0; i < (5); i++) {
    cin >> a[i];
    if (a[i] % 10 != 0) {
      a_max = max(a_max, a[i] % 10);
      a[i] += 10 - (a[i] % 10);
    }
    ans += a[i];
  }
  ans -= a_max;
  cout << ans << endl;
  return 0;
}
