#include <bits/stdc++.h>   using namespace std;   const long long MOD = 1e9 + 7;   int main() {     int n, k;     cin >> n >> k;     cout << k * (6 * (n - 1) + 5) << endl;     for (int i = 1; i <= n; i++) {       printf( %d %d %d %d n , k * (6 * (i - 1) + 1), k * (6 * (i - 1) + 2),              k * (6 * (i - 1) + 3), k * (6 * (i - 1) + 5));     }     return 0;   }   