Take two rows of respective length m and n:
a1, a2, a3,..., am and b1, b2, b3, ..., bn.
Then produce as follows the generated array Gai to contain these elements:
a1, a1+a2, a1+a2+a3, ..., a1+..+am,
a1+..+am+a1, a1+..+am+a1+a2, ...
Alike produce the generated array Gbj to contain...