import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int a = sc.nextInt(); int b = sc.nextInt(); List list = new ArrayList<>(); for(int i = 0 ; i <= a ; i++) { for(int j = 0 ; j <= b ; j++) { if(1 * i + 5 * j == 0) continue; if(!list.contains(1 * i + 5 * j)) { list.add(1 * i + 5 * j); } } } Collections.sort(list); for(int i : list) { System.out.println(i); } } }