System.in.eachLine{{m,n->a=0..m 1.upto(m*n){i->i%n?a+=a[i]:print(a[i]+' \n'[i