#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c, d, e;
  cin >> a >> b >> c >> d >> e;
  int A = (a / 10 + 1) * 10, B = (b / 10 + 1) * 10, C = (c / 10 + 1) * 10,
      D = (d / 10 + 1) * 10, E = (e / 10 + 1) * 10;
  int min = 10;
  if (min > a % 10) {
    min = a % 10;
  }
  if (min > b % 10) {
    min = b % 10;
  }
  if (min > c % 10) {
    min = c % 10;
  }
  if (min > d % 10) {
    min = d % 10;
  }
  if (min > e % 10) {
    min = e % 10;
  }
  cout << A + B + C + D + E - 10 + min << endl;
  return 0;
}
