from itertools import combinations a, b = map(int, input().split()) coins = [1] * a + [5] * b total = set() for n in range(1, a+b+1): for v in combinations(coins, n): total.add(sum(v)) for t in sorted(total): print(t)