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