#include <bits/stdc++.h>
using namespace std;
int main() {
  int min_val = 10, accum = 0;
  int a[5], a_floor[5], diff[5];
  for (int i = 0; i < 5; i++) {
    cin >> a[i];
    a_floor[i] = (a[i] / 10) * 10;
    diff[i] = a[i] - a_floor[i];
    if (diff[i] != 0) min_val = min(min_val, diff[i]);
    accum += a_floor[i];
  }
  cout << accum + 40 + min_val << endl;
  return 0;
}
