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