#include <bits/stdc++.h>
using namespace std;

int GetMax(int a,int b, int c, int d, int e){
  if (a>b&&a>c&&a>d&&a>e) return a;
  else if (b>a&&b>c&&b>d&&b>e) return b;
  else if (c>a&&c>b&&c>d&&c>e) return c;
  else if (d>a&&d>c&&d>b&&d>e) return d;
  else if (e>a&&e>c&&e>d&&e>b) return e;
}


int main() {
  int a,b,c,d,e;
  cin >> a >> b >> c >> d >> e;
  
  int A,B,C,D,E
  A = 10-a%10;
  B = 10-b%10;
  C = 10-c%10;
  D = 10-d%10;
  E = 10-e%10;
  
  a = (a/10+1)*10;
   b = (b/10+1)*10;
   c = (c/10+1)*10;
   d = (d/10+1)*10;
   e = (e/10+1)*10;
  
  int ans=0;
  
  if (A>B&&A>C&&A>D&&A>E) {
    ans = a+b+c+d+e-A;
  }
  else if (B>A&&B>C&&B>D&&B>E) {
     ans = a+b+c+d+e-B;
  }
  else if (C>A&&C>B&&C>D&&C>E) {
     ans = a+b+c+d+e-C;
  }
  else if (D>A&&D>C&&D>B&&D>E) {
     ans = a+b+c+d+e-D;
  }
  else if (E>A&&E>C&&E>D&&E>B) {
     ans = a+b+c+d+e-E;
  }
   
  cout << ans << endl;
  
}
