Problem: Dreamoon likes to play with sets, integers and <image>. <image> is defined as the largest positive integer that divides both a and b.

Let S be a set of exactly four distinct integers greater than 0. Define S to be of rank k if and only if for all pairs of distinct elements si, sj from S, <image>.

Given k and n, Dreamoon wants to make up n sets of rank k using integers from 1 to m such that no integer is used in two different sets (of course you can leave some integers without use). Calculate the minimum m that makes it possible and print one possible solution.

Input

The single line of the input contains two space separated integers n, k (1 ≤ n ≤ 10 000, 1 ≤ k ≤ 100).

Output

On the first line print a single integer — the minimal possible m. 

On each of the next n lines print four space separated integers representing the i-th set.

Neither the order of the sets nor the order of integers within a set is important. If there are multiple possible solutions with minimal m, print any one of them.

Examples

Input

1 1


Output

5
1 2 3 5


Input

2 2


Output

22
2 4 6 22
14 18 10 16

Note

For the first example it's easy to see that set {1, 2, 3, 4} isn't a valid set of rank 1 since <image>.

Solution (in PYTHON):

Solution:
#!/usr/bin/env python
#coding: utf-8
#a = [([0] * 3) for _ in xrange(4)]
#a = [1, 5, 2, 6, 9, 4]
#b = sorted(a, cmp = lambda x, y: cmp(y, x), reverse = True)
#class Node:
#	def __init__(self, X, Y):
#		self.x = X
#		self.y = Y
#a = []
#a.append(Node(1, 2))
#print a[0].x, a[0].y

#while true:
#    try:
#        s = raw_input()
#    except:                # 当遇到文件终结的时候会扔出 EOFError
#        print "EOF"
#        break

in1 = lambda : int(raw_input())
in2 = lambda : map(int, raw_input().split())

ans = [([0] * 4) for _ in xrange(10000)]

def gcd(a, b):
    if (b == 0):
        return a
    return gcd(b, a % b)

l = 1
for i in xrange(0, 10000):
    while (l % 2 == 0):
        l += 1
    ans[i][0], ans[i][1], ans[i][2] = l, l + 1, l + 2
    for j in xrange(l + 4, 1000000, 2):
        p1, p2, p3 = gcd(j, l), gcd(j, l + 1), gcd(j, l + 2)
        if p1 == 1 and p2 == 1 and p3 == 1:
            ans[i][3] = j
            break
    l = j + 1
n, k = map(int, raw_input().split())
print ans[n - 1][3] * k
for i in xrange(0, n):
    print ans[i][0] * k, ans[i][1] * k, ans[i][2] * k, ans[i][3] * k