#include <bits/stdc++.h>
using namespace std;
int a, b, c, d, e;
int ta, tb, tc, td, te;
int maxx = 10;
int ans;
int main() {
  cin >> a >> b >> c >> d >> e;
  ta = a / 10 + (a % 10 != 0 ? 1 : 0);
  tb = b / 10 + (b % 10 != 0 ? 1 : 0);
  tc = c / 10 + (c % 10 != 0 ? 1 : 0);
  td = d / 10 + (d % 10 != 0 ? 1 : 0);
  te = e / 10 + (e % 10 != 0 ? 1 : 0);
  maxx = min(a % 10, b % 10);
  maxx = min(maxx, c % 10);
  maxx = min(maxx, d % 10);
  maxx = min(maxx, e % 10);
  ans = ta * 10 + tb * 10 + tc * 10 + td * 10 + te * 10 - (10 - maxx);
  cout << ans << endl;
  return 0;
}
