#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  int a[5], check, ans, i;
  ans = 0;
  check = 0;
  for (int i = 0; i < (int)(5); i++) {
    cin >> a[i];
    if (a[i] % 10 != 0 && a[i] % 10 < a[check] % 10) {
      check = i;
    }
  }
  int minus = 10 - a[check] % 10;
  for (int i = 0; i < (int)(5); i++) {
    for (int j = 0; j < (int)(10); j++) {
      if (a[i] % 10 != 0) {
        a[i]++;
      } else {
        ans += a[i];
        break;
      }
    }
  }
  cout << ans - minus << endl;
}
