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