package net.ipipip0129.yukicoder.no542; import java.util.ArrayList; import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); String line = scan.nextLine(); scan.close(); int yen1count = Integer.parseInt(line.split(" ")[0]); int yen5count = Integer.parseInt(line.split(" ")[1]); List yenlist = new ArrayList(); for (int i = 1; i <= yen1count; i++) { yenlist.add(i); } for (int j = 1; j <= yen5count; j++) { yenlist.add(j * 5); for (int i = 1; i <= yen1count; i++) { yenlist.add((j * 5) + i); } } yenlist = new ArrayList(new HashSet<>(yenlist)); Collections.sort(yenlist); yenlist.stream().forEach(i -> System.out.println(i)); } }