import java.util.*;

public class Main{
  public static void main(String args[]) {
    Scanner sc = new Scanner(System.in);
    int[] dishes = new int[5];
    int sum = 0;
    int fraction = 0; //端数：fraction
    
    for (int i = 0; i < dishes.length; i++) {
        dishes[i] = sc.nextInt();
        sum += ceil(dishes[i]);
        fraction = Math.max(fraction, amari(dishes[i]));
    }
    System.out.println(sum - fraction);

  }
  
  public static int ceil(int src) {
      if ((src % 10) != 0) {
          return (src / 10 + 1) * 10;
      } else {
          return src;
      }
  }
  
  public static int amari(int src) {
      if ((src % 10) == 0) {
          return 0;
      } else {
          return 10 - src % 10;
      }
  }
  
} import java.util.*; util.* java public class Main{
  public static void main(String args[]) {
    Scanner sc = new Scanner(System.in);
    int[] dishes = new int[5];
    int sum = 0;
    int fraction = 0; //端数：fraction
    
    for (int i = 0; i < dishes.length; i++) {
        dishes[i] = sc.nextInt();
        sum += ceil(dishes[i]);
        fraction = Math.max(fraction, amari(dishes[i]));
    }
    System.out.println(sum - fraction);

  }
  
  public static int ceil(int src) {
      if ((src % 10) != 0) {
          return (src / 10 + 1) * 10;
      } else {
          return src;
      }
  }
  
  public static int amari(int src) {
      if ((src % 10) == 0) {
          return 0;
      } else {
          return 10 - src % 10;
      }
  }
  
} Main public static void main(String args[]) {
    Scanner sc = new Scanner(System.in);
    int[] dishes = new int[5];
    int sum = 0;
    int fraction = 0; //端数：fraction
    
    for (int i = 0; i < dishes.length; i++) {
        dishes[i] = sc.nextInt();
        sum += ceil(dishes[i]);
        fraction = Math.max(fraction, amari(dishes[i]));
    }
    System.out.println(sum - fraction);

  } main {
    Scanner sc = new Scanner(System.in);
    int[] dishes = new int[5];
    int sum = 0;
    int fraction = 0; //端数：fraction
    
    for (int i = 0; i < dishes.length; i++) {
        dishes[i] = sc.nextInt();
        sum += ceil(dishes[i]);
        fraction = Math.max(fraction, amari(dishes[i]));
    }
    System.out.println(sum - fraction);

  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int[] dishes = new int[5]; dishes new int[5] 5 int sum = 0; sum 0 int fraction = 0; fraction 0 for (int i = 0; i < dishes.length; i++) {
        dishes[i] = sc.nextInt();
        sum += ceil(dishes[i]);
        fraction = Math.max(fraction, amari(dishes[i]));
    } int i = 0; int i = 0; i 0 i < dishes.length i dishes.length dishes dishes.length i++ i++ i {
        dishes[i] = sc.nextInt();
        sum += ceil(dishes[i]);
        fraction = Math.max(fraction, amari(dishes[i]));
    } {
        dishes[i] = sc.nextInt();
        sum += ceil(dishes[i]);
        fraction = Math.max(fraction, amari(dishes[i]));
    } dishes[i] = sc.nextInt() dishes[i] dishes i sc.nextInt() sc.nextInt sc sum += ceil(dishes[i]) sum ceil(dishes[i]) ceil dishes[i] dishes i fraction = Math.max(fraction, amari(dishes[i])) fraction Math.max(fraction, amari(dishes[i])) Math.max Math fraction amari(dishes[i]) amari dishes[i] dishes i System.out.println(sum - fraction) System.out.println System.out System System.out sum - fraction sum fraction String args[] args public static int ceil(int src) {
      if ((src % 10) != 0) {
          return (src / 10 + 1) * 10;
      } else {
          return src;
      }
  } ceil {
      if ((src % 10) != 0) {
          return (src / 10 + 1) * 10;
      } else {
          return src;
      }
  } if ((src % 10) != 0) {
          return (src / 10 + 1) * 10;
      } else {
          return src;
      } (src % 10) != 0 (src % 10) src 10 0 {
          return (src / 10 + 1) * 10;
      } return (src / 10 + 1) * 10; (src / 10 + 1) * 10 (src / 10 + 1) src / 10 src 10 1 10 {
          return src;
      } return src; src int src src public static int amari(int src) {
      if ((src % 10) == 0) {
          return 0;
      } else {
          return 10 - src % 10;
      }
  } amari {
      if ((src % 10) == 0) {
          return 0;
      } else {
          return 10 - src % 10;
      }
  } if ((src % 10) == 0) {
          return 0;
      } else {
          return 10 - src % 10;
      } (src % 10) == 0 (src % 10) src 10 0 {
          return 0;
      } return 0; 0 {
          return 10 - src % 10;
      } return 10 - src % 10; 10 - src % 10 10 src % 10 src 10 int src src public class Main{
  public static void main(String args[]) {
    Scanner sc = new Scanner(System.in);
    int[] dishes = new int[5];
    int sum = 0;
    int fraction = 0; //端数：fraction
    
    for (int i = 0; i < dishes.length; i++) {
        dishes[i] = sc.nextInt();
        sum += ceil(dishes[i]);
        fraction = Math.max(fraction, amari(dishes[i]));
    }
    System.out.println(sum - fraction);

  }
  
  public static int ceil(int src) {
      if ((src % 10) != 0) {
          return (src / 10 + 1) * 10;
      } else {
          return src;
      }
  }
  
  public static int amari(int src) {
      if ((src % 10) == 0) {
          return 0;
      } else {
          return 10 - src % 10;
      }
  }
  
} public class Main{
  public static void main(String args[]) {
    Scanner sc = new Scanner(System.in);
    int[] dishes = new int[5];
    int sum = 0;
    int fraction = 0; //端数：fraction
    
    for (int i = 0; i < dishes.length; i++) {
        dishes[i] = sc.nextInt();
        sum += ceil(dishes[i]);
        fraction = Math.max(fraction, amari(dishes[i]));
    }
    System.out.println(sum - fraction);

  }
  
  public static int ceil(int src) {
      if ((src % 10) != 0) {
          return (src / 10 + 1) * 10;
      } else {
          return src;
      }
  }
  
  public static int amari(int src) {
      if ((src % 10) == 0) {
          return 0;
      } else {
          return 10 - src % 10;
      }
  }
  
} Main
import java.util.*;

public class Main{
  public static void main(String args[]) {
    Scanner sc = new Scanner(System.in);
    int[] dishes = new int[5];
    int sum = 0;
    int fraction = 0; //端数：fraction
    
    for (int i = 0; i < dishes.length; i++) {
        dishes[i] = sc.nextInt();
        sum += ceil(dishes[i]);
        fraction = Math.max(fraction, amari(dishes[i]));
    }
    System.out.println(sum - fraction);

  }
  
  public static int ceil(int src) {
      if ((src % 10) != 0) {
          return (src / 10 + 1) * 10;
      } else {
          return src;
      }
  }
  
  public static int amari(int src) {
      if ((src % 10) == 0) {
          return 0;
      } else {
          return 10 - src % 10;
      }
  }
  
}