Problem: Let a be a matrix of size r × c containing positive integers, not necessarily distinct. Rows of the matrix are numbered from 1 to r, columns are numbered from 1 to c. We can construct an array b consisting of r + c integers as follows: for each i ∈ [1, r], let b_i be the greatest common divisor of integers in the i-th row, and for each j ∈ [1, c] let b_{r+j} be the greatest common divisor of integers in the j-th column. 

We call the matrix diverse if all r + c numbers b_k (k ∈ [1, r + c]) are pairwise distinct. 

The magnitude of a matrix equals to the maximum of b_k.

For example, suppose we have the following matrix:

\begin{pmatrix} 2 & 9 & 7\\\ 4 & 144 & 84 \end{pmatrix} 

We construct the array b:

  1. b_1 is the greatest common divisor of 2, 9, and 7, that is 1; 
  2. b_2 is the greatest common divisor of 4, 144, and 84, that is 4; 
  3. b_3 is the greatest common divisor of 2 and 4, that is 2; 
  4. b_4 is the greatest common divisor of 9 and 144, that is 9; 
  5. b_5 is the greatest common divisor of 7 and 84, that is 7. 



So b = [1, 4, 2, 9, 7]. All values in this array are distinct, so the matrix is diverse. The magnitude is equal to 9.

For a given r and c, find a diverse matrix that minimises the magnitude. If there are multiple solutions, you may output any of them. If there are no solutions, output a single integer 0. 

Input

The only line in the input contains two space separated integers r and c (1 ≤ r,c ≤ 500) — the number of rows and the number of columns of the matrix to be found.

Output

If there is no solution, output a single integer 0.

Otherwise, output r rows. The i-th of them should contain c space-separated integers, the j-th of which is a_{i,j} — the positive integer in the i-th row and j-th column of a diverse matrix minimizing the magnitude.

Furthermore, it must hold that 1 ≤ a_{i,j} ≤ 10^9. It can be shown that if a solution exists, there is also a solution with this additional constraint (still having minimum possible magnitude).

Examples

Input


2 2


Output


4 12
2 9

Input


1 1


Output


0

Note

In the first example, the GCDs of rows are b_1 = 4 and b_2 = 1, and the GCDs of columns are b_3 = 2 and b_4 = 3. All GCDs are pairwise distinct and the maximum of them is 4. Since the GCDs have to be distinct and at least 1, it is clear that there are no diverse matrices of size 2 × 2 with magnitude smaller than 4.

In the second example, no matter what a_{1,1} is, b_1 = b_2 will always hold, so there are no diverse matrices.

Solution (in JAVA):

Solution:

//package cf;
import java.io.*;
import java.util.*;

public class T_class {
    static int p=1000000007;
    static int max=(int)3e5;
    static  int my_val=0;
    static boolean prime[]=new boolean[max+5];
    static  int dp[][]=new int[(int)200][410];
    static  List<Integer> total_prime=new ArrayList<>();

    public static void main(String[] args) throws Exception {
        BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(java.io.FileDescriptor.out), "ASCII"), 512);
        FastReader sc=new FastReader();
        int t=1;
        StringBuilder sb2=new StringBuilder();

        seive();
        while(t-- >0) {
            int n=sc.nextInt();
            int m=sc.nextInt();
            int ar[][]=new int[n][m];
            Set<Integer> used=new HashSet<>();
            if(n==1&&m==n)
            {
                sb2.append(0);
            }
            else if(m>=n) {
                int c = 2;
                for (int i = 0; i < m; i++) {
                    ar[0][i] =c++;
                }
                //if(n==1)
                for (int i = 1; i < n; i++) {
                    for (int j = 0; j < m; j++) {
                        ar[i][j] = ar[0][j] * c;
                    }
                    c++;
                }
                for (int i = 0; i < n; i++) {
                    for(int j=0;j<m;j++)
                    {
                        sb2.append(ar[i][j]+" ");
                    }
                    sb2.append("\n");
                    //   System.out.println(Arrays.toString(ar[i]));
                }
            }
            else
            {
                int c=2;
                for (int i = 0; i < n; i++) {
                    ar[i][0] = c++;
                }
                //if(n==1)
                for (int j = 1; j < m; j++) {
                    for (int i = 0; i < n; i++) {
                        ar[i][j] = ar[i][0] * c;
                    }
                    c++;
                }
                for (int i = 0; i < n; i++) {
                    for(int j=0;j<m;j++)
                    {
                        sb2.append(ar[i][j]+" ");
                    }
                    sb2.append("\n");   //System.out.println(Arrays.toString(ar[i]));
                }
            }
        }
        System.out.println(sb2.toString());
        out.flush();
    }
    public static int ans(int ar[],int i,int n,int t)
    {
        if(i>=n)
            return 0;
        if(t>=410)
            return 200000;
        if(dp[i][t]!=-1)
            return dp[i][t];
        //System.out.println(t+" "+i);
        int cur=Math.min(Math.abs(ar[i]-t)+ans(ar,i+1,n,t+1),ans(ar,i,n,t+1));
        dp[i][t]=cur;
        return dp[i][t];
    }

    private static long ncr(int n, int r, long[] fact) {
        if(r>n||n < 0 || r < 0)
            return 0;

        if(n==1||n==0)
            return 1;
        // System.out.println(n+" c "+r);

        return (((fact[n]*pow_inverse(fact[n-r],p))%p)*pow_inverse(fact[r],p))%p;
    }
    static  int ht[]=new int[max];
    static class BIT {
        long[] tree;
        public BIT(int size) {
            tree = new long[size + 1];
        }
        public long sum(int i) {
            long ans = 0;
            while (i > 0) {
                ans += tree[i];
                i -= i & -i;
            }
            return ans;
        }

        public long query(int i, int j) {
            return sum(j) - sum(i - 1);
        }

        public void add(int i, long val) {
            while (i < tree.length) {
                tree[i] += val;
                i += i & -i;
            }
        }

        public void set(int i, long val) {
            add(i, val - query(i, i));
        }
    }
    static class  vert implements Comparator<vert>
    {
        int v;
        TreeSet<Integer> set;

        public vert(int v, TreeSet<Integer> set) {
            this.v = v;
            this.set = set;
        }

        @Override
        public int compare(vert o1, vert o2) {
            return -(o1.set.size()-o2.set.size());
        }
    }
    public static long pow(long a,long b,long m)
    {
        long r=1;
        while(b!=1)
        {
            if(b%2!=0)
                r=(r*a)%m;
            b=b>>1;
            a=(a*a)%m;
        }
        return (r*a)%m;
    }
    public static long pow_inverse(long a,long m)
    {
        return pow(a,m-2,m);
    }public static long gcd(long a,long b)
    {
        if(b>a)
        {
            a=a^b;
            b=a^b;
            a=a^b;
        }
        if(b==0)
            return a;
        return gcd(b,a%b);
    }
    public static void extgcd(long a,long b)
    {/*
            if(a==0)
            {
                x=0;
                y=1;
                d=b;
                // return ;
            }
            else
            {

                extgcd(b%a,a);

                long t=y;
                y=x;
                x=t-(b/a)*x;
            }*/
    }
    public static void dfs(List<Integer> adj[],int u,int p)
    {
        ht[u]=ht[p]==1?2:1;
        for(int v:adj[u])
        {
            if(v!=p)
            {
                dfs(adj,v,u);
            }
        }
    }
    public static void seive()
    {
        for(int i=0;i<max;i++)
            prime[i] = true;

        for(int p = 2; p*p <=max; p++)
        {
            // If prime[p] is not changed, then it is a prime
            if(prime[p] == true)
            {
                // Update all multiples of p
                for(int i = p*p; i <=max; i += p)
                    prime[i] = false;
            }
        }

        // Print all prime numbers
        for(int i = 2; i <= max; i++)
        {
            if(prime[i] == true)
            {
                total_prime.add(i);
            }
        }
    }
    public static boolean union(int a, int b, int p[], int r[]){
        // add your code here
        int pa=find(a,p,r);
        int pb=find(b,p,r);
        if(pa==pb)
            return true;
        if(pa!=pb)
        {
            if(r[pa]<r[pb])
            {
                p[pa]=pb;
            }
            else if(r[pa]>r[pb])
            {
                p[pb]=pa;
            }
            else
            {
                p[pa]=pb;
                r[pb]++;
            }
        }
        return false;
    }
    public static int find(int x,int p[],int r[])
    {
        if(p[x]==x)
            return x;
        p[x]=find(p[x],p,r);
        return p[x];
    }
    public static int binary_Search_upper(Integer[] ar, Integer x,int l,int r)
    {
        int res=-1,f=0;
        while(l<=r)
        {
            int mid=(l+r)>>1;
            if(ar[mid]==x)
            {
                f=1;
                res=mid;
                l=mid+1;
            }
            else if(ar[mid]>x)
            {
                res=res!=-1&&ar[res]==x?res:mid;
                r=mid-1;
            }
            else
            {
                l=mid+1;
            }
        }
        return f==1?res:res+1;
    }
    public static int binary_Search_lower(int[] ar, long x, int l, int r)
    {
        int res=0,f=0;
        //int l=0;int r=ar.length-1;
        /*public static int binary(Long[] ar, int l, int r, long v)
        {
            int n=r;
            int m=(l+r)/2;
            int re=-1;
            while(l<=r)
            {
                if(ar[m]>=v)
                {

                    re=m;
                    r=m-1;
                }
                else if(ar[m]<v)
                {
                    l=m+1;
                }
                m=(l+r)/2;
            }
            if(l<=n&&ar[l]==v)
                return l;
            return re;
        }*/
        //   System.out.println(Arrays.toString(ar)+" "+x);
        while(l<=r)
        {
            int mid=(l+r)>>1;
            //   System.out.println(l+" "+r+" "+mid+" = "+ar[mid]);
            if(ar[mid]==x)
            {
                f=1;
                res=mid;
                r=mid-1;
            }
            else if(ar[mid]>x)
            {
                r=mid-1;
            }
            else
            {
                res=res!=0&&ar[res]==x?res:mid;
                l=mid+1;
            }
        }

        //  System.out.println(res);
        return f==1?res:res+1;
    } public static int binary_Search_lower_suf(int[] ar, int x,int l,int r)
    {
        int res=-1,f=0;
        //int l=0;int r=ar.length-1;
        while(l<=r)
        {
            int mid=(l+r)>>1;
            if(ar[mid]==x)
            {
                f=1;
                res=mid;
                r=mid-1;
            }
            else if(ar[mid]<x)
            {
                r=mid-1;
            }
            else
            {
                //      res=mid;
                l=mid+1;
            }
        }
        return f==0?res+1:res;
    }
    int bit[]=new int[(int)1e6];
    public void update(int n,int val,int i)
    {
        i++;
        while(i<n)
        {
            bit[i]+=val;
            i+=(i)&(-i);
        }

    }
    public long query(int n,int i)
    {
        i++;
        long sum=0;
        while(i>0)
        {
            sum+=bit[i];
            i-=(i)&(-i);
        }
        return sum;
    }


    ///////////////////////////////////////////////////////////////////////////////////
    //////////////////////////////////////////////////////////////////////////////////////////////
    static class FastReader {

        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }


}