import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int total = 0;
    int n[] = new int[5];
    int saigo = 0;
    for(int i = 0;i<5;i++){
      n[i] = sc.nextInt();
      int a = n[i]/10;
      if(n[i]%10==0){
        total+=n[i];
      }else{
        total+=(a+1)*10;
        saigo=Math.max(saigo,(a+1)*10-n[i]);
      }
    }

    System.out.println(total-saigo);
  }
} import java.util.*; util.* java public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int total = 0;
    int n[] = new int[5];
    int saigo = 0;
    for(int i = 0;i<5;i++){
      n[i] = sc.nextInt();
      int a = n[i]/10;
      if(n[i]%10==0){
        total+=n[i];
      }else{
        total+=(a+1)*10;
        saigo=Math.max(saigo,(a+1)*10-n[i]);
      }
    }

    System.out.println(total-saigo);
  }
} Main public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int total = 0;
    int n[] = new int[5];
    int saigo = 0;
    for(int i = 0;i<5;i++){
      n[i] = sc.nextInt();
      int a = n[i]/10;
      if(n[i]%10==0){
        total+=n[i];
      }else{
        total+=(a+1)*10;
        saigo=Math.max(saigo,(a+1)*10-n[i]);
      }
    }

    System.out.println(total-saigo);
  } main {
    Scanner sc = new Scanner(System.in);
    int total = 0;
    int n[] = new int[5];
    int saigo = 0;
    for(int i = 0;i<5;i++){
      n[i] = sc.nextInt();
      int a = n[i]/10;
      if(n[i]%10==0){
        total+=n[i];
      }else{
        total+=(a+1)*10;
        saigo=Math.max(saigo,(a+1)*10-n[i]);
      }
    }

    System.out.println(total-saigo);
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int total = 0; total 0 int n[] = new int[5]; n new int[5] 5 int saigo = 0; saigo 0 for(int i = 0;i<5;i++){
      n[i] = sc.nextInt();
      int a = n[i]/10;
      if(n[i]%10==0){
        total+=n[i];
      }else{
        total+=(a+1)*10;
        saigo=Math.max(saigo,(a+1)*10-n[i]);
      }
    } int i = 0; int i = 0; i 0 i<5 i 5 i++ i++ i {
      n[i] = sc.nextInt();
      int a = n[i]/10;
      if(n[i]%10==0){
        total+=n[i];
      }else{
        total+=(a+1)*10;
        saigo=Math.max(saigo,(a+1)*10-n[i]);
      }
    } {
      n[i] = sc.nextInt();
      int a = n[i]/10;
      if(n[i]%10==0){
        total+=n[i];
      }else{
        total+=(a+1)*10;
        saigo=Math.max(saigo,(a+1)*10-n[i]);
      }
    } n[i] = sc.nextInt() n[i] n i sc.nextInt() sc.nextInt sc int a = n[i]/10; a n[i]/10 n[i] n i 10 if(n[i]%10==0){
        total+=n[i];
      }else{
        total+=(a+1)*10;
        saigo=Math.max(saigo,(a+1)*10-n[i]);
      } n[i]%10==0 n[i]%10 n[i] n i 10 0 {
        total+=n[i];
      } total+=n[i] total n[i] n i {
        total+=(a+1)*10;
        saigo=Math.max(saigo,(a+1)*10-n[i]);
      } total+=(a+1)*10 total (a+1)*10 (a+1) a 1 10 saigo=Math.max(saigo,(a+1)*10-n[i]) saigo Math.max(saigo,(a+1)*10-n[i]) Math.max Math saigo (a+1)*10-n[i] (a+1)*10 (a+1) a 1 10 n[i] n i System.out.println(total-saigo) System.out.println System.out System System.out total-saigo total saigo String[] args args public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int total = 0;
    int n[] = new int[5];
    int saigo = 0;
    for(int i = 0;i<5;i++){
      n[i] = sc.nextInt();
      int a = n[i]/10;
      if(n[i]%10==0){
        total+=n[i];
      }else{
        total+=(a+1)*10;
        saigo=Math.max(saigo,(a+1)*10-n[i]);
      }
    }

    System.out.println(total-saigo);
  }
} public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int total = 0;
    int n[] = new int[5];
    int saigo = 0;
    for(int i = 0;i<5;i++){
      n[i] = sc.nextInt();
      int a = n[i]/10;
      if(n[i]%10==0){
        total+=n[i];
      }else{
        total+=(a+1)*10;
        saigo=Math.max(saigo,(a+1)*10-n[i]);
      }
    }

    System.out.println(total-saigo);
  }
} Main
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int total = 0;
    int n[] = new int[5];
    int saigo = 0;
    for(int i = 0;i<5;i++){
      n[i] = sc.nextInt();
      int a = n[i]/10;
      if(n[i]%10==0){
        total+=n[i];
      }else{
        total+=(a+1)*10;
        saigo=Math.max(saigo,(a+1)*10-n[i]);
      }
    }

    System.out.println(total-saigo);
  }
}
