#include <bits/stdc++.h>
using namespace std;
int main() {
  int A[5];
  cin >> A[0];
  cin >> A[1];
  cin >> A[2];
  cin >> A[3];
  cin >> A[4];
  int ans = 0;
  int maxnum = 0;
  for (int i = 0; i < 5; i++) {
    int adition = A[i] % 10;
    ans += A[i] + 10 - adition;
    if (adition > 0) {
      maxnum = max(maxnum, (10 - adition));
    }
  }
  cout << (ans - maxnum) << endl;
  return 0;
}
