#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[5], min, mod10min, ans;
  min = 123;
  mod10min = 9;
  for (int i = 0; i < 5; i++) {
    cin >> a[i];
    if (a[i] % 10 != 0) {
      if (a[i] % 10 < mod10min) {
        min = a[i];
        mod10min = a[i] % 10;
      }
    }
  }
  ans = 0;
  for (int i = 0; i < 5; i++) {
    if (a[i] != min) ans += (a[i] / 10 + 1) * 10;
  }
  ans += min;
  cout << ans << endl;
  return 0;
}
