#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[5];
  for (int(i) = 0; (i) < (5); (i)++) cin >> a[i];
  int t = 200;
  int ind;
  int sum = 0;
  for (int(i) = 0; (i) < (5); (i)++) {
    if (a[i] % 10 != 0 && t >= a[i] % 10) {
      t = a[i] % 10;
      ind = i;
      sum += a[i];
      sum = sum + (10 - a[i] % 10);
    } else if (a[i] % 10 == 0) {
      sum += a[i];
    } else {
      sum += a[i];
      sum = sum + (10 - a[i] % 10);
    }
  }
  int ans;
  ans = sum - (10 - a[ind] % 10);
  cout << ans << endl;
  return 0;
}
