import java.util.*;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int[] data = new int[5];
    int[] table = new int[5];

    for (int i = 0; i < 5; i++) {
      data[i] = sc.nextInt();
      table[i] = (10-data[i]%10)%10;
    }

    Arrays.sort(table);

    int total = 0;

    for (int i = 0; i < 5; i++) {
      total += data[i] + table[i];
    }

    System.out.println(total-table[4]);


  }

} import java.util.*; util.* java public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int[] data = new int[5];
    int[] table = new int[5];

    for (int i = 0; i < 5; i++) {
      data[i] = sc.nextInt();
      table[i] = (10-data[i]%10)%10;
    }

    Arrays.sort(table);

    int total = 0;

    for (int i = 0; i < 5; i++) {
      total += data[i] + table[i];
    }

    System.out.println(total-table[4]);


  }

} Main public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int[] data = new int[5];
    int[] table = new int[5];

    for (int i = 0; i < 5; i++) {
      data[i] = sc.nextInt();
      table[i] = (10-data[i]%10)%10;
    }

    Arrays.sort(table);

    int total = 0;

    for (int i = 0; i < 5; i++) {
      total += data[i] + table[i];
    }

    System.out.println(total-table[4]);


  } main {
    Scanner sc = new Scanner(System.in);
    int[] data = new int[5];
    int[] table = new int[5];

    for (int i = 0; i < 5; i++) {
      data[i] = sc.nextInt();
      table[i] = (10-data[i]%10)%10;
    }

    Arrays.sort(table);

    int total = 0;

    for (int i = 0; i < 5; i++) {
      total += data[i] + table[i];
    }

    System.out.println(total-table[4]);


  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int[] data = new int[5]; data new int[5] 5 int[] table = new int[5]; table new int[5] 5 for (int i = 0; i < 5; i++) {
      data[i] = sc.nextInt();
      table[i] = (10-data[i]%10)%10;
    } int i = 0; int i = 0; i 0 i < 5 i 5 i++ i++ i {
      data[i] = sc.nextInt();
      table[i] = (10-data[i]%10)%10;
    } {
      data[i] = sc.nextInt();
      table[i] = (10-data[i]%10)%10;
    } data[i] = sc.nextInt() data[i] data i sc.nextInt() sc.nextInt sc table[i] = (10-data[i]%10)%10 table[i] table i (10-data[i]%10)%10 (10-data[i]%10) 10 data[i]%10 data[i] data i 10 10 Arrays.sort(table) Arrays.sort Arrays table int total = 0; total 0 for (int i = 0; i < 5; i++) {
      total += data[i] + table[i];
    } int i = 0; int i = 0; i 0 i < 5 i 5 i++ i++ i {
      total += data[i] + table[i];
    } {
      total += data[i] + table[i];
    } total += data[i] + table[i] total data[i] + table[i] data[i] data i table[i] table i System.out.println(total-table[4]) System.out.println System.out System System.out total-table[4] total table[4] table 4 String[] args args public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int[] data = new int[5];
    int[] table = new int[5];

    for (int i = 0; i < 5; i++) {
      data[i] = sc.nextInt();
      table[i] = (10-data[i]%10)%10;
    }

    Arrays.sort(table);

    int total = 0;

    for (int i = 0; i < 5; i++) {
      total += data[i] + table[i];
    }

    System.out.println(total-table[4]);


  }

} public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int[] data = new int[5];
    int[] table = new int[5];

    for (int i = 0; i < 5; i++) {
      data[i] = sc.nextInt();
      table[i] = (10-data[i]%10)%10;
    }

    Arrays.sort(table);

    int total = 0;

    for (int i = 0; i < 5; i++) {
      total += data[i] + table[i];
    }

    System.out.println(total-table[4]);


  }

} Main
import java.util.*;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int[] data = new int[5];
    int[] table = new int[5];

    for (int i = 0; i < 5; i++) {
      data[i] = sc.nextInt();
      table[i] = (10-data[i]%10)%10;
    }

    Arrays.sort(table);

    int total = 0;

    for (int i = 0; i < 5; i++) {
      total += data[i] + table[i];
    }

    System.out.println(total-table[4]);


  }

}
