#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int a, b, c, d, e;
  cin >> a >> b >> c >> d >> e;
  int f = (10 - (a % 10)) % 10;
  int g = (10 - (a % 10)) % 10;
  int h = (10 - (a % 10)) % 10;
  int i = (10 - (a % 10)) % 10;
  int j = (10 - (a % 10)) % 10;
  int ans = ((a - 1) / 10) * 10 + ((b - 1) / 10) * 10 + ((c - 1) / 10) * 10 +
            ((d - 1) / 10) * 10 + ((e - 1) / 10) * 10 + 50;
  cout << ans - max(f, max(g, max(h, max(i, j)))) << endl;
}
