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 JAVA):

Solution:

import java.util.*;
import java.io.*;
public class B {
    public static long time = 0;
    public static void main(String[] args) throws Exception {
        time = System.currentTimeMillis();
        
        IN = System.in;
        OUT = System.out;
        in = new BufferedReader(new InputStreamReader(IN));
        out = new PrintWriter(OUT, FLUSH);
        solveOne();
        out.flush();
    }
    static long MOD = (long) (1e9) + 7l;
    public static void solveOne() throws Exception {
        long n = nl();
        long k = nl();
        long f1 = n * 6l - 1l;
        long m = f1 * k;
        pn(m);
        for(long i = 0 ; i < n; i++){
//          long[] cur = {(i * 6l + 1l) * k , (i * 6l + 2l) * k , (i * 6l + 3l) * k , (i * 6l + 5l) * k};
//          for (int j = 0 ; j < 4; j++){
//              for (int w = j + 1; w < 4; w++){
////                    px(cur[j], cur[w], BigInteger.valueOf(cur[j]).gcd(BigInteger.valueOf(cur[w]) ) );
//                  if (BigInteger.valueOf(cur[j]).gcd(BigInteger.valueOf(cur[w])).longValue() != k){
//                      px(cur[j], cur[w], BigInteger.valueOf(cur[j]).gcd(BigInteger.valueOf(cur[w]) ) );
//                  }
//              }
//          }
//          px(cur);
            pn((i * 6l + 1l) * k + " " + (i * 6l + 2l) * k + " " + (i * 6l + 3l) * k + " " + (i * 6l + 5l) * k);
        }
    }
    
    public static void solveTwo() throws Exception {
        
    }
    
    public static void solveThree() throws Exception {
        
    }
    
    public static BufferedReader in;
    public static StringTokenizer st;
    public static InputStream IN;
    public static OutputStream OUT;
    public static String nx() throws Exception {
        for (;st == null || !st.hasMoreTokens();){
            String k1 = in.readLine();
            if (k1 == null) return null;
            st = new StringTokenizer(k1);
        }
        return st.nextToken();
    }
    public static int ni () throws Exception {
        return Integer.parseInt(nx());
    }
    public static long nl() throws Exception{
        return Long.parseLong(nx());
    }
    public static double nd() throws Exception{
        return Double.parseDouble(nx());
    }
    public static void px(Object ... l1){
        System.out.println(Arrays.deepToString(l1));
    }
    public static boolean FLUSH = false;
    public static PrintWriter out;
    public static void p(Object ... l1){
        for (int i = 0; i < l1.length; i++){
            if (i != 0) out.print(' ');
            out.print(l1[i].toString());
        }
    }
    public static void pn(Object ... l1){
        for (int i = 0; i < l1.length; i++){
            if (i != 0) out.print(' ');
            out.print(l1[i].toString());
        }
        out.println();
    }
    
    public static void pn(Collection l1){
        boolean first = true;
        for (Object e: l1){
            if (first) first = false;
            else out.print(' ');
            out.print(e.toString());
        }
        out.println();
    }

}