import java.util.*;

class Main{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int sum = 0;
        int temp = 0;
        int i = 0;
        int e = 0;
        //余りが一番小さいものを最後に注文する。
        int r[] = new int[5];
        int s = 11;
        int t = 11;
        for(int k = 0; k<5; k++){
          r[k] = sc.nextInt();
        }

        for(i = 0; i < 5; i++){
          s = Math.min(t,r[i]%10);
          if(t != s && r[i]%10 !=0){
          e = i;
          t = s; 
          }
        }
        temp = r[4];
        r[4] = r[e];
        r[e] = temp;

        for(int j = 0; j < 4; j++){
          if(r[j] % 10 != 0){
            sum = 10 - (r[j] % 10) + r[j] +sum;
          }else{
            sum += r[j];
          }
        }
        sum += r[4];
        System.out.println(sum);
    }
} import java.util.*; util.* java class Main{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int sum = 0;
        int temp = 0;
        int i = 0;
        int e = 0;
        //余りが一番小さいものを最後に注文する。
        int r[] = new int[5];
        int s = 11;
        int t = 11;
        for(int k = 0; k<5; k++){
          r[k] = sc.nextInt();
        }

        for(i = 0; i < 5; i++){
          s = Math.min(t,r[i]%10);
          if(t != s && r[i]%10 !=0){
          e = i;
          t = s; 
          }
        }
        temp = r[4];
        r[4] = r[e];
        r[e] = temp;

        for(int j = 0; j < 4; j++){
          if(r[j] % 10 != 0){
            sum = 10 - (r[j] % 10) + r[j] +sum;
          }else{
            sum += r[j];
          }
        }
        sum += r[4];
        System.out.println(sum);
    }
} Main public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int sum = 0;
        int temp = 0;
        int i = 0;
        int e = 0;
        //余りが一番小さいものを最後に注文する。
        int r[] = new int[5];
        int s = 11;
        int t = 11;
        for(int k = 0; k<5; k++){
          r[k] = sc.nextInt();
        }

        for(i = 0; i < 5; i++){
          s = Math.min(t,r[i]%10);
          if(t != s && r[i]%10 !=0){
          e = i;
          t = s; 
          }
        }
        temp = r[4];
        r[4] = r[e];
        r[e] = temp;

        for(int j = 0; j < 4; j++){
          if(r[j] % 10 != 0){
            sum = 10 - (r[j] % 10) + r[j] +sum;
          }else{
            sum += r[j];
          }
        }
        sum += r[4];
        System.out.println(sum);
    } main {
        Scanner sc = new Scanner(System.in);
        int sum = 0;
        int temp = 0;
        int i = 0;
        int e = 0;
        //余りが一番小さいものを最後に注文する。
        int r[] = new int[5];
        int s = 11;
        int t = 11;
        for(int k = 0; k<5; k++){
          r[k] = sc.nextInt();
        }

        for(i = 0; i < 5; i++){
          s = Math.min(t,r[i]%10);
          if(t != s && r[i]%10 !=0){
          e = i;
          t = s; 
          }
        }
        temp = r[4];
        r[4] = r[e];
        r[e] = temp;

        for(int j = 0; j < 4; j++){
          if(r[j] % 10 != 0){
            sum = 10 - (r[j] % 10) + r[j] +sum;
          }else{
            sum += r[j];
          }
        }
        sum += r[4];
        System.out.println(sum);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int sum = 0; sum 0 int temp = 0; temp 0 int i = 0; i 0 int e = 0; e 0 int r[] = new int[5]; r new int[5] 5 int s = 11; s 11 int t = 11; t 11 for(int k = 0; k<5; k++){
          r[k] = sc.nextInt();
        } int k = 0; int k = 0; k 0 k<5 k 5 k++ k++ k {
          r[k] = sc.nextInt();
        } {
          r[k] = sc.nextInt();
        } r[k] = sc.nextInt() r[k] r k sc.nextInt() sc.nextInt sc for(i = 0; i < 5; i++){
          s = Math.min(t,r[i]%10);
          if(t != s && r[i]%10 !=0){
          e = i;
          t = s; 
          }
        } i = 0; i = 0 i 0 i < 5 i 5 i++ i++ i {
          s = Math.min(t,r[i]%10);
          if(t != s && r[i]%10 !=0){
          e = i;
          t = s; 
          }
        } {
          s = Math.min(t,r[i]%10);
          if(t != s && r[i]%10 !=0){
          e = i;
          t = s; 
          }
        } s = Math.min(t,r[i]%10) s Math.min(t,r[i]%10) Math.min Math t r[i]%10 r[i] r i 10 if(t != s && r[i]%10 !=0){
          e = i;
          t = s; 
          } t != s && r[i]%10 !=0 t != s t s r[i]%10 !=0 r[i]%10 r[i] r i 10 0 {
          e = i;
          t = s; 
          } e = i e i t = s t s temp = r[4] temp r[4] r 4 r[4] = r[e] r[4] r 4 r[e] r e r[e] = temp r[e] r e temp for(int j = 0; j < 4; j++){
          if(r[j] % 10 != 0){
            sum = 10 - (r[j] % 10) + r[j] +sum;
          }else{
            sum += r[j];
          }
        } int j = 0; int j = 0; j 0 j < 4 j 4 j++ j++ j {
          if(r[j] % 10 != 0){
            sum = 10 - (r[j] % 10) + r[j] +sum;
          }else{
            sum += r[j];
          }
        } {
          if(r[j] % 10 != 0){
            sum = 10 - (r[j] % 10) + r[j] +sum;
          }else{
            sum += r[j];
          }
        } if(r[j] % 10 != 0){
            sum = 10 - (r[j] % 10) + r[j] +sum;
          }else{
            sum += r[j];
          } r[j] % 10 != 0 r[j] % 10 r[j] r j 10 0 {
            sum = 10 - (r[j] % 10) + r[j] +sum;
          } sum = 10 - (r[j] % 10) + r[j] +sum sum 10 - (r[j] % 10) + r[j] +sum 10 - (r[j] % 10) + r[j] +sum 10 - (r[j] % 10) 10 (r[j] % 10) r[j] r j 10 r[j] r j sum {
            sum += r[j];
          } sum += r[j] sum r[j] r j sum += r[4] sum r[4] r 4 System.out.println(sum) System.out.println System.out System System.out sum String args[] args
import java.util.*;

class Main{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int sum = 0;
        int temp = 0;
        int i = 0;
        int e = 0;
        //余りが一番小さいものを最後に注文する。
        int r[] = new int[5];
        int s = 11;
        int t = 11;
        for(int k = 0; k<5; k++){
          r[k] = sc.nextInt();
        }

        for(i = 0; i < 5; i++){
          s = Math.min(t,r[i]%10);
          if(t != s && r[i]%10 !=0){
          e = i;
          t = s; 
          }
        }
        temp = r[4];
        r[4] = r[e];
        r[e] = temp;

        for(int j = 0; j < 4; j++){
          if(r[j] % 10 != 0){
            sum = 10 - (r[j] % 10) + r[j] +sum;
          }else{
            sum += r[j];
          }
        }
        sum += r[4];
        System.out.println(sum);
    }
}
