1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#include <bits/stdc++.h>
using namespace std;
#define st first
#define nd second

const int INF = 3e3 + 7;
unsigned long long n, k, x, nwd, nww, c;

int NWD(int a, int b){
    if(b!=0)
    	return NWD(b,a%b);
    return a;
}

int main(){
	cin.tie(0);
	cout.tie(0);
	ios_base::sync_with_stdio(0);
	cin >> n;
	for(int i = 1; i <= n; i++){
		cin >> k;
		if(k == 0){
			if(i == 1){
				c = 1;
			}
			continue;
		}
		if(i == 1){
			c = k;
		}
		else{
			nwd = NWD(c, k);
			nww = c * k / nwd;
			// cout << nww;
			/*c1 = res;
			nww1 = nww;
			nwd = NWD(nww , res);
			res = nww1 * c1 / nwd;*/
			c = nww;
		}
		for(int j = 1; j <= k; j++){
			cin >> x;
		}
	}
	cout << nww;
} 
/*
6
15 14 18 20 13 12
*/