#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c, d, e, p;
  cin >> a >> b >> c >> d >> e;
  int aa, bb, cc, dd, ee;
  aa = a % 10;
  bb = b % 10;
  cc = c % 10;
  dd = d % 10;
  ee = e % 10;
  int sum;
  sum = a + b + c + d + e;
  if (aa != 0) {
    sum = sum + 10 - aa;
  }
  if (bb != 0) {
    sum = sum + 10 - bb;
  }
  if (cc != 0) {
    sum = sum + 10 - cc;
  }
  if (dd != 0) {
    sum = sum + 10 - dd;
  }
  if (ee != 0) {
    sum = sum + 10 - ee;
  }
  cout << sum << endl;
}
