int A,B,C,D,N,M;

int main() {
  ios::sync_with_stdio(false);
  /*
  cin >> A >> B >> C >> D >> E;
  A = A % 10;
  B = B % 10;
  C = C % 10;
  D = D % 10;
  E = E % 10;
  */
  int a[10];
  int b[10];
  int c[10];
  int min = 100000;
  int id = -1;
  for(int i = 0; i < 5; i++) {
    cin >> a[i];
    b[i] = a[i] % 10;
    c[i] = a[i] / 10;
    if(b[i] < min && b[i] != 0) {
      id = i;
      min = b[i];
    }
  }
int sum = 0;
  for(int i = 0; i < 5; i++) {
    if(i == id) {
      sum += c[i]*10;
      continue;
    }
    else if(a[i] % 10 == 0) sum += a[i];
    else sum += c[i]*10+10;
  }
  sum += b[id];
  cout << sum;



  return 0;
}

                                                   45,0-1       末尾
