#include <bits/stdc++.h>
using namespace std;
int main() {
  std::ios::sync_with_stdio(false);
  int sum, temp, m = 11;
  for (int i = 0; i < 5; ++i) {
    cin >> temp;
    if (temp % 10 != 0) m = min(m, temp % 10);
    sum += (int)ceil(temp / 10.0);
  }
  cout << (sum - 1) * 10 + (m == 11 ? 10 : m);
}
