#include <bits/stdc++.h>
using namespace std;
int kiriage(int x) {
  int y;
  y = x % 10;
  return (x + 10 - y);
}
int max(int a, int b) {
  if (a > b) {
    return a;
  } else {
    return b;
  }
}
int main() {
  int a, b, c, d, e;
  cin >> a >> b >> c >> d >> e;
  int A, B, C, D, E;
  A = kiriage(a);
  B = kiriage(b);
  C = kiriage(c);
  D = kiriage(d);
  E = kiriage(e);
  int sum = A + B + C + D + E;
  int k = max(max(max(max(A - a, B - b), C - c), D - d), E - e);
  cout << sum - k;
}
