Vasya is a Greencode wildlife preservation society proponent. One day he found an empty field nobody owned, divided it into n × m squares and decided to plant a forest there. Vasya will plant nm trees of all different heights from 1 to nm. For his forest to look more natural he wants any two trees growing in the side neighbouring squares to have the absolute value of difference in heights to be strictly more than 1. Help Vasya: make the plan of the forest planting for which this condition is fulfilled.

Input

The first line contains two space-separated integers n and m (1 ≤ n, m ≤ 100) — the number of rows and columns on Vasya's field

Output

If there's no solution, print -1. Otherwise, print n lines containing m numbers each — the trees' planting plan. In every square of the plan the height of a tree that should be planted on this square should be written. If there are several solutions to that problem, print any of them.

Examples

Input

2 3


Output

3 6 2
5 1 4


Input

2 1


Output

-1

Difficulty: MEDIUM_HARD
Tags: Constructive algorithms

Starter code:

Solutions:
def some_random_function():
	x = 10
	x *= 100
	i_dont_know = x
	why_am_i_writing_this = x * x
	print(i_dont_know)
	print(why_am_i_writing_this)

def some_random_function5():
	x = 10
	x *= 100
	i_dont_know = x
	why_am_i_writing_this = x * x
	print(i_dont_know)
	print(why_am_i_writing_this)
import os, sys
from io import BytesIO, IOBase

def main():
	(n, m) = map(int, input().split())
	arr = [[0] * m for _ in range(n)]
	if m >= 4:
		arr[0] = list(range(m - 1, 0, -2)) + list(range(m, 0, -2))
		for i in range(1, n):
			for j in range(m):
				arr[i][j] = arr[i - 1][j] + m
	elif n >= 4:
		for (ind, i) in enumerate(list(range(n - 1, 0, -2)) + list(range(n, 0, -2))):
			arr[ind][0] = i
		for j in range(1, m):
			for i in range(n):
				arr[i][j] = arr[i][j - 1] + n
	elif n == 2 and m == 3:
		arr = [[3, 6, 2], [5, 1, 4]]
	elif n == 3 and m == 2:
		arr = [[3, 5], [6, 1], [2, 4]]
	elif n == 3 and m == 3:
		arr = [[1, 7, 4], [3, 9, 6], [5, 2, 8]]
	elif n == 1 and m == 1:
		arr = [[1]]
	else:
		print(-1)
		return
	for i in arr:
		print(*i)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def some_random_function1():
	x = 10
	x *= 100
	i_dont_know = x
	why_am_i_writing_this = x * x
	print(i_dont_know)
	print(why_am_i_writing_this)

def some_random_function2():
	x = 10
	x *= 100
	i_dont_know = x
	why_am_i_writing_this = x * x
	print(i_dont_know)
	print(why_am_i_writing_this)

def some_random_function3():
	x = 10
	x *= 100
	i_dont_know = x
	why_am_i_writing_this = x * x
	print(i_dont_know)
	print(why_am_i_writing_this)

def some_random_function4():
	x = 10
	x *= 100
	i_dont_know = x
	why_am_i_writing_this = x * x
	print(i_dont_know)
	print(why_am_i_writing_this)

def some_random_function6():
	x = 10
	x *= 100
	i_dont_know = x
	why_am_i_writing_this = x * x
	print(i_dont_know)
	print(why_am_i_writing_this)

def some_random_function7():
	x = 10
	x *= 100
	i_dont_know = x
	why_am_i_writing_this = x * x
	print(i_dont_know)
	print(why_am_i_writing_this)

def some_random_function8():
	x = 10
	x *= 100
	i_dont_know = x
	why_am_i_writing_this = x * x
	print(i_dont_know)
	print(why_am_i_writing_this)
main()


import os
import sys
from io import BytesIO, IOBase

def main():
	(n, m) = map(int, input().split())
	z = n * m
	(y, a) = (z - (z % 2 == 0), [[] for _ in range(n)])
	for i in range(n):
		for j in range(m):
			a[i].append(y)
			y -= 2
			if y < 0:
				y = z - z % 2
	for i in range(n):
		for j in range(m):
			if i + 1 < n and abs(a[i][j] - a[i + 1][j]) < 2:
				if j > 0 and abs(a[i][j - 1] - a[i + 1][j]) > 1:
					(a[i][j - 1], a[i][j]) = (a[i][j], a[i][j - 1])
				elif j + 1 < m and abs(a[i][j + 1] - a[i + 1][j]) > 1:
					(a[i][j + 1], a[i][j]) = (a[i][j], a[i][j + 1])
	for i in range(n):
		for j in range(m):
			if j + 1 < m and abs(a[i][j] - a[i][j + 1]) < 2 or (i + 1 < n and abs(a[i][j] - a[i + 1][j]) < 2):
				print(-1)
				return
	for i in a:
		print(*i)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


def solve(n, m):
	if n * m == 1:
		return [[1]]
	if n * m <= 3 or (n == 2 and m == 2):
		return -1
	a = [[0] * m for _ in range(n)]
	base1 = 1
	base2 = n * m // 2 + 1
	for i in range(n):
		for j in range(m):
			if (i + j) % 2 == 0:
				a[i][j] = base2
				base2 += 1
			else:
				a[i][j] = base1
				base1 += 1
	return a

def pr(a, n, m):
	if a == -1:
		print(a)
	else:
		for _ in range(n):
			print(' '.join([str(x) for x in a[_]]))
(n, m) = map(int, input().split())
pr(solve(n, m), n, m)


(n, m) = map(int, input().split())
transpose = False
if n > m:
	(n, m) = (m, n)
	transpose = True
if n == 1 and m == 1:
	print(1)
	import sys
	sys.exit()
if n == 1 and m < 4 or (n == 2 and m < 3):
	print(-1)
	import sys
	sys.exit()
if n == 1:
	row = m * [None]
	for c in range(1, m, 2):
		row[c] = (c + 1) // 2
	first = m // 2 + 1
	for c in range(0, m, 2):
		row[c] = first + c // 2
	result = [row]
else:
	result = n * [None]
	for r in range(n):
		result[r] = [c for c in range(r * m + 1, (r + 1) * m + 1)]
	for r in range(1, n):
		for c in range(r % 2, m, 2):
			(result[r - 1][c], result[r][c]) = (result[r][c], result[r - 1][c])
if transpose:
	arr = m * [None]
	for c in range(m):
		arr[c] = [result[r][c] for r in range(n)]
	result = arr
for row in result:
	print(' '.join(map(str, row)))