#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
const long long INF = 100000000;
long long ma = 1000000000 + 7;
int h, w, n, m;
char maze[60][60];
int dis[60][60];
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int main() {
  int a[5];
  int b[5];
  int c[5];
  for (long long i = 0; i < 5; i++) {
    cin >> a[i];
    b[i] = 10 - (a[i] % 10);
    c[i] = a[i] + b[i];
  }
  int max = 0;
  for (int i = 0; i < 5; i++) {
    chmax(max, b[i]);
  }
  int res = 0;
  for (int i = 0; i < 5; i++) {
    if (b[i] != max) {
      res += c[i];
    } else {
      res += a[i];
    }
  }
  cout << res << endl;
}
