#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> a(5);
  int sum = 0, cnt = 0;
  for (int i = 0; i < 5; i++) cin >> a[i];
  for (int i = 0; i < 5; i++) {
    if (a[i] % 10 == 0) {
      cnt++;
      sum += a[i];
    }
  }
  for (int i = 9; 0 < i; i--) {
    for (int j = 0; j < 5; j++) {
      if (a[j] % 10 == i) {
        if (cnt == 4) {
          sum += a[j];
          cout << sum << endl;
          return 0;
        } else {
          cnt++;
          int b = (a[j] / 10 + 1) * 10;
          sum += b;
        }
      }
    }
  }
}
