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