#include <bits/stdc++.h>
const long long MOD = 1e9 + 7;
using namespace std;
int main() {
  int a, min = 9;
  int b[5];
  for (int(i) = (0); (i) < (5); ++(i)) {
    cin >> a;
    if (a % 10 == 0) {
      b[i] = a;
    } else {
      b[i] = a - (a % 10) + 10;
      if (min > (a % 10)) {
        min = (a % 10);
      }
    }
  }
  int ans = 0;
  for (int(i) = (0); (i) < (5); ++(i)) {
    ans += b[i];
  }
  ans += (min - 10);
  cout << ans << endl;
}
