import java.util.*;

public class Main {
  public static void main(String[] args) { 
    Scanner in = new Scanner(System.in);
    int[] ip = new int[5];
    int count = 0;
    int sur = 10;
    int a;
    for (int i = 0; i < 5; i++) {
      a = in.nextInt();
      if (a % 10 < sur && a % 10 != 0) sur = a % 10;
      if (a % 10 != 0) count++;
      ip[i] = a / 10;
    }
    a = (count - 1) * 10 + sur;
    for (int n : ip) {
      a += n * 10;
    }
    System.out.println(a);
  }
} import java.util.*; util.* java public class Main {
  public static void main(String[] args) { 
    Scanner in = new Scanner(System.in);
    int[] ip = new int[5];
    int count = 0;
    int sur = 10;
    int a;
    for (int i = 0; i < 5; i++) {
      a = in.nextInt();
      if (a % 10 < sur && a % 10 != 0) sur = a % 10;
      if (a % 10 != 0) count++;
      ip[i] = a / 10;
    }
    a = (count - 1) * 10 + sur;
    for (int n : ip) {
      a += n * 10;
    }
    System.out.println(a);
  }
} Main public static void main(String[] args) { 
    Scanner in = new Scanner(System.in);
    int[] ip = new int[5];
    int count = 0;
    int sur = 10;
    int a;
    for (int i = 0; i < 5; i++) {
      a = in.nextInt();
      if (a % 10 < sur && a % 10 != 0) sur = a % 10;
      if (a % 10 != 0) count++;
      ip[i] = a / 10;
    }
    a = (count - 1) * 10 + sur;
    for (int n : ip) {
      a += n * 10;
    }
    System.out.println(a);
  } main { 
    Scanner in = new Scanner(System.in);
    int[] ip = new int[5];
    int count = 0;
    int sur = 10;
    int a;
    for (int i = 0; i < 5; i++) {
      a = in.nextInt();
      if (a % 10 < sur && a % 10 != 0) sur = a % 10;
      if (a % 10 != 0) count++;
      ip[i] = a / 10;
    }
    a = (count - 1) * 10 + sur;
    for (int n : ip) {
      a += n * 10;
    }
    System.out.println(a);
  } Scanner in = new Scanner(System.in); in new Scanner(System.in) int[] ip = new int[5]; ip new int[5] 5 int count = 0; count 0 int sur = 10; sur 10 int a; a for (int i = 0; i < 5; i++) {
      a = in.nextInt();
      if (a % 10 < sur && a % 10 != 0) sur = a % 10;
      if (a % 10 != 0) count++;
      ip[i] = a / 10;
    } int i = 0; int i = 0; i 0 i < 5 i 5 i++ i++ i {
      a = in.nextInt();
      if (a % 10 < sur && a % 10 != 0) sur = a % 10;
      if (a % 10 != 0) count++;
      ip[i] = a / 10;
    } {
      a = in.nextInt();
      if (a % 10 < sur && a % 10 != 0) sur = a % 10;
      if (a % 10 != 0) count++;
      ip[i] = a / 10;
    } a = in.nextInt() a in.nextInt() in.nextInt in if (a % 10 < sur && a % 10 != 0) sur = a % 10; a % 10 < sur && a % 10 != 0 a % 10 < sur a % 10 a 10 sur a % 10 != 0 a % 10 a 10 0 sur = a % 10 sur a % 10 a 10 if (a % 10 != 0) count++; a % 10 != 0 a % 10 a 10 0 count++ count ip[i] = a / 10 ip[i] ip i a / 10 a 10 a = (count - 1) * 10 + sur a (count - 1) * 10 + sur (count - 1) * 10 (count - 1) count 1 10 sur for (int n : ip) {
      a += n * 10;
    } int n ip {
      a += n * 10;
    } {
      a += n * 10;
    } a += n * 10 a n * 10 n 10 System.out.println(a) System.out.println System.out System System.out a String[] args args public class Main {
  public static void main(String[] args) { 
    Scanner in = new Scanner(System.in);
    int[] ip = new int[5];
    int count = 0;
    int sur = 10;
    int a;
    for (int i = 0; i < 5; i++) {
      a = in.nextInt();
      if (a % 10 < sur && a % 10 != 0) sur = a % 10;
      if (a % 10 != 0) count++;
      ip[i] = a / 10;
    }
    a = (count - 1) * 10 + sur;
    for (int n : ip) {
      a += n * 10;
    }
    System.out.println(a);
  }
} public class Main {
  public static void main(String[] args) { 
    Scanner in = new Scanner(System.in);
    int[] ip = new int[5];
    int count = 0;
    int sur = 10;
    int a;
    for (int i = 0; i < 5; i++) {
      a = in.nextInt();
      if (a % 10 < sur && a % 10 != 0) sur = a % 10;
      if (a % 10 != 0) count++;
      ip[i] = a / 10;
    }
    a = (count - 1) * 10 + sur;
    for (int n : ip) {
      a += n * 10;
    }
    System.out.println(a);
  }
} Main
import java.util.*;

public class Main {
  public static void main(String[] args) { 
    Scanner in = new Scanner(System.in);
    int[] ip = new int[5];
    int count = 0;
    int sur = 10;
    int a;
    for (int i = 0; i < 5; i++) {
      a = in.nextInt();
      if (a % 10 < sur && a % 10 != 0) sur = a % 10;
      if (a % 10 != 0) count++;
      ip[i] = a / 10;
    }
    a = (count - 1) * 10 + sur;
    for (int n : ip) {
      a += n * 10;
    }
    System.out.println(a);
  }
}