package yukicoder; import java.util.ArrayList; import java.util.Collections; import java.util.Scanner; public class N542 { public static void main(String[] args){ Scanner sc = new Scanner(System.in); int ichiYen = sc.nextInt(); int goYen = sc.nextInt(); int i, j; ArrayList array = new ArrayList(); for(i = 0;i <= ichiYen;++i){ for(j = 0;j <= goYen;++j){ if(!array.contains(i + (j * 5)) && (i + (j * 5)) != 0) array.add(i + (j * 5)); } } Collections.sort(array); for(int k:array){ System.out.println(k); } } }