CROC 2016 - Final Round [Private, For Onsite Finalists Only]
A
Gambling Nim
Codeforces
2400
原题
←B →
翻译中…

As you know, the game of "Nim" is played with $*n*$ piles of stones, where the $*i*$-th pile initially contains $*a*_{*i*}$ stones. Two players alternate the turns. During a turn a player picks any non-empty pile and removes any positive number of stones from it. The one who is not able to make a move loses the game.

翻译中…

Petya and Vasya are tired of playing Nim, so they invented their own version of the game and named it the "Gambling Nim". They have $*n*$ two-sided cards, one side of the $*i*$-th card has number $*a*_{*i*}$ written on it, while the other side has number $*b*_{*i*}$. At the beginning of the game the players put all the cards on the table, each card only one of its sides up, and this side is chosen independently and uniformly. Thus they obtain a sequence $*c*_{1}, *c*_{2}, ..., *c*_{*n*}$, where $*c*_{*i*}$ is equal to $*a*_{*i*}$ or $*b*_{*i*}$. Then they take $*n*$ piles of stones, with $*i*$-th pile containing exactly $*c*_{*i*}$ stones and play Nim. Petya takes the first turn.

翻译中…

Given that both players play optimally, find the probability of Petya's victory. Output the answer as an irreducible fraction.

翻译中…

Input

翻译中…

The first line of the input contains a single integer $*n*$ ($1 ≤ *n* ≤ 500 000$) — the number of cards in the deck.

翻译中…

Each of the following $*n*$ lines contains the description of one card, consisting of two integers $*a*_{*i*}$ and $*b*_{*i*}$ ($0 ≤ *a*_{*i*}, *b*_{*i*} ≤ 10^{18}$).

翻译中…

Output

翻译中…

Output the answer as an irreducible fraction $*p* / *q*$. If the probability of Petya's victory is $0$, print 0/1.

翻译中…

样例

Input #1
2
1 1
1 1
Output #1
0/1
InputCopy OutputCopy
Input #2
2
1 2
1 2
Output #2
1/2
InputCopy OutputCopy
Input #3
3
0 4
1 5
2 3
Output #3
1/1
InputCopy OutputCopy
题目信息
题号
662A
时间限制
2 s
内存限制
512 MB
标签
位运算
数学
矩阵
概率论

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。