import java.util.*;

class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    int[] time = new int[5];
    int min = 10;
    int n = 0;
    for(int i = 0;i < 5;i ++){
      time[i] = Integer.parseInt(scan.nextLine());
      if((time[i] - 1) % 10 < min){
        min = (time[i] - 1) % 10;
        n = i;
      }
    }
    int sum = 0;
    for(int i = 0;i < 5;i ++){
      if(i != n){
        if(time[i] % 10 == 0){
          sum += time[i];
        }else{
          sum += (time[i] / 10 + 1) * 10;
        }
      }
    }
    System.out.println(sum + time[n]);
  }
} import java.util.*; util.* java class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    int[] time = new int[5];
    int min = 10;
    int n = 0;
    for(int i = 0;i < 5;i ++){
      time[i] = Integer.parseInt(scan.nextLine());
      if((time[i] - 1) % 10 < min){
        min = (time[i] - 1) % 10;
        n = i;
      }
    }
    int sum = 0;
    for(int i = 0;i < 5;i ++){
      if(i != n){
        if(time[i] % 10 == 0){
          sum += time[i];
        }else{
          sum += (time[i] / 10 + 1) * 10;
        }
      }
    }
    System.out.println(sum + time[n]);
  }
} Main public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    int[] time = new int[5];
    int min = 10;
    int n = 0;
    for(int i = 0;i < 5;i ++){
      time[i] = Integer.parseInt(scan.nextLine());
      if((time[i] - 1) % 10 < min){
        min = (time[i] - 1) % 10;
        n = i;
      }
    }
    int sum = 0;
    for(int i = 0;i < 5;i ++){
      if(i != n){
        if(time[i] % 10 == 0){
          sum += time[i];
        }else{
          sum += (time[i] / 10 + 1) * 10;
        }
      }
    }
    System.out.println(sum + time[n]);
  } main {
    Scanner scan = new Scanner(System.in);
    int[] time = new int[5];
    int min = 10;
    int n = 0;
    for(int i = 0;i < 5;i ++){
      time[i] = Integer.parseInt(scan.nextLine());
      if((time[i] - 1) % 10 < min){
        min = (time[i] - 1) % 10;
        n = i;
      }
    }
    int sum = 0;
    for(int i = 0;i < 5;i ++){
      if(i != n){
        if(time[i] % 10 == 0){
          sum += time[i];
        }else{
          sum += (time[i] / 10 + 1) * 10;
        }
      }
    }
    System.out.println(sum + time[n]);
  } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int[] time = new int[5]; time new int[5] 5 int min = 10; min 10 int n = 0; n 0 for(int i = 0;i < 5;i ++){
      time[i] = Integer.parseInt(scan.nextLine());
      if((time[i] - 1) % 10 < min){
        min = (time[i] - 1) % 10;
        n = i;
      }
    } int i = 0; int i = 0; i 0 i < 5 i 5 i ++ i ++ i {
      time[i] = Integer.parseInt(scan.nextLine());
      if((time[i] - 1) % 10 < min){
        min = (time[i] - 1) % 10;
        n = i;
      }
    } {
      time[i] = Integer.parseInt(scan.nextLine());
      if((time[i] - 1) % 10 < min){
        min = (time[i] - 1) % 10;
        n = i;
      }
    } time[i] = Integer.parseInt(scan.nextLine()) time[i] time i Integer.parseInt(scan.nextLine()) Integer.parseInt Integer scan.nextLine() scan.nextLine scan if((time[i] - 1) % 10 < min){
        min = (time[i] - 1) % 10;
        n = i;
      } (time[i] - 1) % 10 < min (time[i] - 1) % 10 (time[i] - 1) time[i] time i 1 10 min {
        min = (time[i] - 1) % 10;
        n = i;
      } min = (time[i] - 1) % 10 min (time[i] - 1) % 10 (time[i] - 1) time[i] time i 1 10 n = i n i int sum = 0; sum 0 for(int i = 0;i < 5;i ++){
      if(i != n){
        if(time[i] % 10 == 0){
          sum += time[i];
        }else{
          sum += (time[i] / 10 + 1) * 10;
        }
      }
    } int i = 0; int i = 0; i 0 i < 5 i 5 i ++ i ++ i {
      if(i != n){
        if(time[i] % 10 == 0){
          sum += time[i];
        }else{
          sum += (time[i] / 10 + 1) * 10;
        }
      }
    } {
      if(i != n){
        if(time[i] % 10 == 0){
          sum += time[i];
        }else{
          sum += (time[i] / 10 + 1) * 10;
        }
      }
    } if(i != n){
        if(time[i] % 10 == 0){
          sum += time[i];
        }else{
          sum += (time[i] / 10 + 1) * 10;
        }
      } i != n i n {
        if(time[i] % 10 == 0){
          sum += time[i];
        }else{
          sum += (time[i] / 10 + 1) * 10;
        }
      } if(time[i] % 10 == 0){
          sum += time[i];
        }else{
          sum += (time[i] / 10 + 1) * 10;
        } time[i] % 10 == 0 time[i] % 10 time[i] time i 10 0 {
          sum += time[i];
        } sum += time[i] sum time[i] time i {
          sum += (time[i] / 10 + 1) * 10;
        } sum += (time[i] / 10 + 1) * 10 sum (time[i] / 10 + 1) * 10 (time[i] / 10 + 1) time[i] / 10 time[i] time i 10 1 10 System.out.println(sum + time[n]) System.out.println System.out System System.out sum + time[n] sum time[n] time n String[] args args
import java.util.*;

class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    int[] time = new int[5];
    int min = 10;
    int n = 0;
    for(int i = 0;i < 5;i ++){
      time[i] = Integer.parseInt(scan.nextLine());
      if((time[i] - 1) % 10 < min){
        min = (time[i] - 1) % 10;
        n = i;
      }
    }
    int sum = 0;
    for(int i = 0;i < 5;i ++){
      if(i != n){
        if(time[i] % 10 == 0){
          sum += time[i];
        }else{
          sum += (time[i] / 10 + 1) * 10;
        }
      }
    }
    System.out.println(sum + time[n]);
  }
}
