#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[4];
  int b[4];
  for (int i = 0; i < 5; i++) {
    cin >> a[i];
    if (a[i] % 10 >= 5) {
      b[i] = a[i] + a[i] % 10;
    } else {
      b[i] = a[i] - a[i] % 10;
    }
  }
  int res = 0;
  for (int i = 0; i < 5; i++) {
    if (a[i] % 10 > res) {
      res = a[i] % 10;
    }
  }
  int ans = 0;
  for (int i = 0; i < 5; i++) {
    ans += b[i];
  }
  cout << ans - res << endl;
}
