import java.util.Scanner class No542() { var input = Scanner(System. `in`) var oneYenCount = input.nextInt() var fiveYenCount = input.nextInt() var oneYenList = yenCount(oneYenCount, 1) var fiveYenList = yenCount(fiveYenCount, 5) var list = fullSearch() fun yenCount(count: Int, plus: Int): MutableList { var sum = plus var list: MutableList = mutableListOf() for (i in 0..count - 1) { list.add(sum) sum += plus } return list } fun fullSearch(): MutableList { var list: MutableList = mutableListOf() for (i in 0..oneYenCount - 1) { for (j in 0..fiveYenCount - 1) { oneYenList[i] += fiveYenList[j] list.add(oneYenList[i]) oneYenList[i] -= fiveYenList[j] } } return list } } fun main(args: Array) { var no542 = No542() println((no542.list + no542.oneYenList + no542.fiveYenList).distinct().sorted()) }