#include <bits/stdc++.h>
using namespace std;
int dy[] = {0, 0, 1, -1, 0};
int dx[] = {1, -1, 0, 0, 0};
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a, b, x, y;
  vector<int> s(5);
  cin >> s[0] >> s[1] >> s[2] >> s[3] >> s[4];
  b = 0;
  x = 100;
  y = 0;
  for (int i = 0; i < (int)(5); i++) {
    if (s[i] % 10 == 0) {
      b += s[i];
    } else {
      if (s[i] % 10 < x) {
        x = s[i] % 10;
        y = s[i];
      }
      b += (s[i] / 10 + 1) * 10;
    }
  }
  cout << b - (10 - y % 10) << endl;
  return 0;
}
