{"raw_statement":[{"iden":"statement","content":"Laërdos is organizing a party and invited all his N mathematician friends. He decided to decorate his party with positive integers, ranging from 1 to 1018. He's now struggling to choose the integers that he's going to use because his friends are very picky about numbers.\n\nHe talked to all his friends beforehand, and they all told him their preferences. Each one of them described their preference by either:\n\nHe wants to know how many integers he can use that will please all his friends.\n\nThe first line of the input contains a single integer N (1 ≤ N ≤ 105) indicating the number of friends that were invited to the party.\n\nEach of the following N lines describes the preferences of each friend. The i-th line contains the preferences of the i-th friend and has the following format:\n\nt s l1 ... ls\n\nt is 1 if the friend listed the integers that he or she likes and 2 otherwise. s (1 ≤ s ≤ 105) indicates the number of integers that were listed. It is followed by s integers l1... ls (1 ≤ lj ≤ 1018), indicating the integers that the friend listed.\n\nThe total number of integers listed by all friends is not greater than 2 × 105.\n\nOutput a single integer, the number of integers that all Laërdos' friends like.\n\n"},{"iden":"input","content":"The first line of the input contains a single integer N (1 ≤ N ≤ 105) indicating the number of friends that were invited to the party.Each of the following N lines describes the preferences of each friend. The i-th line contains the preferences of the i-th friend and has the following format:t s l1 ... lst is 1 if the friend listed the integers that he or she likes and 2 otherwise. s (1 ≤ s ≤ 105) indicates the number of integers that were listed. It is followed by s integers l1... ls (1 ≤ lj ≤ 1018), indicating the integers that the friend listed.The total number of integers listed by all friends is not greater than 2 × 105."},{"iden":"output","content":"Output a single integer, the number of integers that all Laërdos' friends like."},{"iden":"examples","content":"Input31 3 1 2 32 1 11 3 1 2 4Output1Input51 3 1 2 31 3 1 2 41 3 1 2 51 3 1 2 72 1 8Output2Input21 2 10 112 2 10 11Output0"}],"translated_statement":null,"sample_group":[],"show_order":[],"formal_statement":"**Definitions**  \nLet $ G = (V, E) $ be a weighted undirected graph, where:  \n- $ V = \\{1, 2, \\dots, N\\} $ is the set of locations.  \n- $ E \\subseteq \\binom{V}{2} $ is the set of roads, each edge $ e = (u, v) \\in E $ has a positive weight $ w(e) \\in \\mathbb{R}^+ $ representing traversal time.  \nLet $ s, t \\in V $ be source and target locations.  \n\nLet $ d_G(s, t) $ denote the shortest path distance from $ s $ to $ t $ in $ G $.  \n\nFor any edge $ e \\in E $, let $ G - e $ denote the graph with edge $ e $ removed.  \n\n**Constraints**  \n1. $ 1 \\le N, M \\le 10^5 $  \n2. $ 1 \\le w(e) \\le 10^9 $ for all $ e \\in E $  \n3. $ G $ is connected and there exists at least one path from $ s $ to $ t $.  \n\n**Objective**  \nCompute:  \n$$\n\\max_{e \\in E} \\left( d_{G - e}(s, t) \\right)\n$$  \nIf for some $ e \\in E $, $ s $ and $ t $ are disconnected in $ G - e $, then return $ -1 $.","simple_statement":"Given a city with N locations and M roads, each road connects two locations with a travel time. Find the maximum possible travel time from s to t if exactly one road is blocked. If blocking any road makes s and t unreachable, output -1. People always take the fastest path.","has_page_source":false}