#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, p = 0, q = 9;
  for (int i = 0; i < 5; ++i) {
    cin >> a;
    if (a % 10 == 0)
      p += a;
    else {
      if (q > a % 10) q = a % 10;
      int x = a / 10;
      p += (x + 1) * 10;
    }
  }
  long long int ans;
  ans = p - 10 + q;
  cout << ans << endl;
}
