qyliang/CodeNanoFix huggingface dataset:
# Buggy code:
import fractions
from collections import Counter
N = int(input())
A_B = []
mod = 1000000007
for _ in range(N):
    A, B = map(int, input().split())
    if A < 0:
        A = -A
        B = -B
    C = fractions.gcd(abs(A), abs(B))
    A_B.append((A//C, B//C))
A_B_C = Counter(A_B)


hate_couple = 0
ans = 1
Done = set([])
for key, value in A_B_C.items():
    if key in Done:
        continue
    keya, keyb = key
    a = 0
    if keyb < 0:
        keya = -keya
        keyb = -keyb
    if (keyb, -keya) not in A_B_C:
        a = pow(2, value, mod)
    else:
        a = (pow(2, value, mod) - 1) + (pow(2, A_B_C[(keyb, -keya)], mod) - 1) + 1
        Done.add((keyb, -keya))
    ans *= a
    Done.add(key)

print(ans - 1)

# Fixed code:
import math
from collections import Counter

N = int(input())
A_B = []
mod = 1000000007
for _ in range(N):
    A, B = map(int, input().split())
    if (A == 0) and (B == 0):
        A_B.append((A, B))
    elif A == 0:
        A_B.append((0, -1))
    elif B == 0:
        A_B.append((1, 0))
    else:
        if A < 0:
            A = -A
            B = -B
        C = math.gcd(abs(A), abs(B))
        A_B.append((A // C, B // C))

A_B_C = Counter(A_B)


ans = 1
Done = set([])
Done.add((0, 0))
for key, value in A_B_C.items():
    if key in Done:
        continue
    keya, keyb = key
    a = 0
    if keya == 0 and keyb == 0:
        a = value + 1
        Done.add((0, 0))
    else:
        if keyb < 0:
            keya = -keya
            keyb = -keyb
        if (keyb, -keya) not in A_B_C:
            a = pow(2, value, mod)
        else:
            a = (pow(2, value, mod) - 1) + (pow(2, A_B_C[(keyb, -keya)], mod) - 1) + 1
            Done.add((keyb, -keya))
    ans *= a
    ans %= mod
    Done.add(key)
ans -= 1
ans += A_B_C[(0, 0)]

print(ans % mod)
# Buggy code:
import math
mod = 10**9+7
N = int(input())

iwashi01 = 0
iwashi10 = 0
iwashi00 = 0
iwashi = dict()
for i in range(N):
    a, b = map(int, input().split())
    g = math.gcd(abs(a), abs(b))
    a //= g; b //= g
    if a == 0 and b == 0:
        iwashi00 += 1
    elif a == 0:
        iwashi01 += 1
    elif b == 0:
        iwashi10 += 1            
    else:
        if a*b > 0:
            if a < 0 and b < 0:
                a *= -1
                b *= -1
            iwashi.setdefault((a, b), [0, 0])
            iwashi[(a, b)][0] += 1
        if a*b < 0:
            if a < 0 and b > 0:
                a *= -1
                b *= -1
            a, b = -b, a
            iwashi.setdefault((a, b), [0, 0])
            iwashi[(a, b)][1] += 1

r = 2**iwashi01 % mod - 1 + 2**iwashi10 % mod - 1 + 1
for s, t in iwashi.values():
    r *= 2**s % mod -1 + 2**t % mod -1 + 1
        r %= mod
    print(r + iwashi00 - 1)

# Fixed code:
import math
mod = 10**9+7
N = int(input())

iwashi01 = 0
iwashi10 = 0
iwashi00 = 0
iwashi = dict()
for i in range(N):
    a, b = map(int, input().split())
    if a == 0 and b == 0:
        iwashi00 += 1
    elif a == 0:
        iwashi01 += 1
    elif b == 0:
        iwashi10 += 1            
    else:
        g = math.gcd(abs(a), abs(b))
        a //= g; b //= g
        if a*b > 0:
            if a < 0 and b < 0:
                a *= -1
                b *= -1
            iwashi.setdefault((a, b), [0, 0])
            iwashi[(a, b)][0] += 1
        if a*b < 0:
            if a < 0 and b > 0:
                a *= -1
                b *= -1
            a, b = -b, a
            iwashi.setdefault((a, b), [0, 0])
            iwashi[(a, b)][1] += 1

r = 2**iwashi01 % mod - 1 + 2**iwashi10 % mod - 1 + 1
for s, t in iwashi.values():
    r *= 2**s % mod -1 + 2**t % mod -1 + 1
    r %= mod
print((r + iwashi00 - 1) % mod)
# Buggy code:
from sys import stdin
from collections import deque, Counter, defaultdict
from fractions import gcd
import heapq

MOD = 10 ** 9 + 7
input = stdin.readline

n = int(input())
zero = 0
A, B = [], []
# mp = defaultdict(lambda: [0, 0])
mp = {}
for i in range(n):
    ai, bi = map(int, input().split())
    if ai == 0 and bi == 0:
        zero += 1
        continue

    gi = gcd(ai, bi)
    ai = ai // gi
    bi = bi // gi

    if bi < 0:
        ai = -ai
        bi = -bi
    if bi == 0 and ai < 0:
        ai = -ai
    if ai <= 0:
        ai, bi = bi, -ai
        if (ai, bi) in mp:
            mp[(ai, bi)][0] += 1
        else:
            mp[(ai, bi)] = [1, 0]
    else:
        if (ai, bi) in mp:
            mp[(ai, bi)][1] += 1
        else:
            mp[(ai, bi)] = [0, 1]

ans = 1
for key in mp:
    s, t = mp[key]
    ans *= pow(2, s, MOD) + pow(2, t, MOD) - 1
    ans %= MOD
print((zero - 1 + ans) % MOD)

# Fixed code:
from sys import stdin
from collections import deque, Counter, defaultdict
# from fractions import gcd
from math import gcd
import heapq

MOD = 10 ** 9 + 7
input = stdin.readline

n = int(input())
zero = 0
A, B = [], []
# mp = defaultdict(lambda: [0, 0])
mp = {}
for i in range(n):
    ai, bi = map(int, input().split())
    if ai == 0 and bi == 0:
        zero += 1
        continue

    gi = gcd(ai, bi)
    ai = ai // gi
    bi = bi // gi

    if bi < 0:
        ai = -ai
        bi = -bi
    if bi == 0 and ai < 0:
        ai = -ai
    if ai <= 0:
        ai, bi = bi, -ai
        if (ai, bi) in mp:
            mp[(ai, bi)][0] += 1
        else:
            mp[(ai, bi)] = [1, 0]
    else:
        if (ai, bi) in mp:
            mp[(ai, bi)][1] += 1
        else:
            mp[(ai, bi)] = [0, 1]

ans = 1
for key in mp:
    s, t = mp[key]
    ans *= pow(2, s, MOD) + pow(2, t, MOD) - 1
    ans %= MOD
print((zero - 1 + ans) % MOD)
# Buggy code:
import sys
input = sys.stdin.readline

from fractions import gcd


MOD = 10**9+7
N = int(input())
F = []
zero_v = 0
inf = 0
zero = 0
for _ in range(N):
  x,y = map(int,input().split())
  if x==0 and y==0:
    zero_v += 1
  elif x==0:
    inf += 1
  elif y==0:
    zero += 1
  else:
    G = gcd(abs(x),abs(y))
    F.append((x//G,y//G))

setF = set(F)

all_keys = set()

for x,y in setF:
  if x*y >0:
    if x>0:
      all_keys.add((x,y))
    else:
      all_keys.add((-x,-y))
  x,y = -y,x
  if x*y >0:
    if x>0:
      all_keys.add((x,y))
    else:
      all_keys.add((-x,-y))

all_dic = {k:[0,0] for k in all_keys}

for x,y in F:
  if x*y > 0:
    if x>0:
      all_dic[(x,y)][0] += 1
    else:
      all_dic[(-x,-y)][0] += 1
  else:
    if x>0:
      all_dic[(-y,x)][1] += 1
    else:
      all_dic[(y,-x)][1] += 1

ans = (pow(2,inf,MOD)) + (pow(2,zero,MOD))-1
ans %= MOD

for k in all_keys:
  P,N = all_dic[k]
  ans *= (pow(2,P,MOD)) + (pow(2,N,MOD))-1
  ans %= MOD


ans += zero_v-1

print(ans%MOD)

# Fixed code:
import sys
input = sys.stdin.readline
import math

MOD = 10**9+7
N = int(input())
F = []
zero_v = 0
inf = 0
zero = 0
for _ in range(N):
  x,y = map(int,input().split())
  if x==0 and y==0:
    zero_v += 1
  elif x==0:
    inf += 1
  elif y==0:
    zero += 1
  else:
    G = math.gcd(abs(x),abs(y))
    F.append((x//G,y//G))

all_keys = set()

for x,y in F:
  if x*y >0:
    if x>0:
      all_keys.add((x,y))
    else:
      all_keys.add((-x,-y))
  x,y = -y,x
  if x*y >0:
    if x>0:
      all_keys.add((x,y))
    else:
      all_keys.add((-x,-y))

all_dic = {k:[0,0] for k in all_keys}

for x,y in F:
  if x*y > 0:
    if x>0:
      all_dic[(x,y)][0] += 1
    else:
      all_dic[(-x,-y)][0] += 1
  else:
    if x>0:
      all_dic[(-y,x)][1] += 1
    else:
      all_dic[(y,-x)][1] += 1

ans = (pow(2,inf,MOD)) + (pow(2,zero,MOD))-1
ans %= MOD

for k in all_keys:
  P,N = all_dic[k]
  ans *= (pow(2,P,MOD)) + (pow(2,N,MOD))-1
  ans %= MOD


ans += zero_v-1

print(ans%MOD)
# Buggy code:
from math import gcd
n = int(input())
p = 10**9 + 7
iwashi = {}
bad = 0
ans = 1
for i in range(n):
    x, y = map(int, input().split())
    if(x == 0 and y == 0):
      bad += 1
      continue
    elif(x == 0):
        iwashi[(0, -1)] += 1
        continue
    elif(y == 0):
        iwashi[(1, 0)] += 1
        continue
    else:
        g = gcd(x, y)
        x, y = x // g, y // g
        if x < 0:
            x, y = -x, -y
        try:
        	iwashi[(x, y)] += 1
        except KeyError:
            iwashi[(x, y)] = 1
            
for x, y in iwashi:
    a = iwashi[(x, y)]
    if y > 0:
    	rx,ry = y, -x
    else:
      	rx,ry = y, -x
    try:
        b = iwashi[(rx,ry)]
        iwashi[(rx,ry)] = 0
    except KeyError:
      	b = 0
    ans *= pow(2, a, p) + pow(2, b, p) - 1
    ans %= p
    iwashi[(x, y)] = 0
print((ans + bad - 1) % p)

# Fixed code:
from math import gcd
n = int(input())
p = 10**9 + 7
iwashi = {}
bad = 0
ans = 1
for i in range(n):
    x, y = map(int, input().split())
    if(x == 0 and y == 0):
      bad += 1
      continue
    elif(x == 0):
        try:
        	iwashi[(0, 1)] += 1
        except KeyError:
            iwashi[(0, 1)] = 1
            continue
    elif(y == 0):
        try:
        	iwashi[(1, 0)] += 1
        except KeyError:
            iwashi[(1, 0)] = 1
        continue
    else:
        g = gcd(x, y)
        x, y = x // g, y // g
        if x < 0:
            x, y = -x, -y
        try:
        	iwashi[(x, y)] += 1
        except KeyError:
            iwashi[(x, y)] = 1
            
for x, y in iwashi:
    a = iwashi[(x, y)]
    if y > 0:
    	rx,ry = y, -x
    else:
      	rx,ry = -y, x
    try:
        b = iwashi[(rx,ry)]
        iwashi[(rx,ry)] = 0
    except KeyError:
      	b = 0
    ans *= pow(2, a, p) + pow(2, b, p) - 1
    ans %= p
    iwashi[(x, y)] = 0
print((ans + bad - 1) % p)
# Buggy code:
import math
def main():
    N = int(input())
    d = {}
    zb = 0
    za = 0
    zab = 0
    r = 0
    mod = 10**9 + 7
    for i in range(N):
        a, b = map(int, input().split())
        if a== 0 and b == 0:
            zab += 1
        elif b == 0:
            zb += 1
        elif a == 0:
            za += 1
        else:
            if a < 0:
                a = -a
                b = -b
            x = math.gcd(abs(a), abs(b))
            if (a//x, b//x) in d:
                d[(a//x, b//x)] += 1
            else:
                d[(a//x, b//x)] = 1
    used = set()
    l = []
    for x in d:
        if x in used:
            continue
        a, b = x[0], x[1]
        used.add(x)
        if a * b > 0:
            t = (abs(b), -abs(a))
            if t in d:
                used.add(t)
                l.append((d[x], d[t]))
            else:
                l.append((1, 0))
        else:
            t = (abs(b), abs(a))
            if t in d:
                used.add(t)
                l.append((d[x], d[t]))
            else:
                l.append((1, 0))
    r = zab + pow(2, za) + pow(2, zb) - 2
    for i in l:
        r *= (pow(2, i[0]) + pow(2, i[1]) - 1)
        r %= mod
    return r % mod - 1
print(main())


# Fixed code:
import math
def main():
    N = int(input())
    d = {}
    zb = 0
    za = 0
    zab = 0
    r = 0
    mod = 10**9 + 7
    for i in range(N):
        a, b = map(int, input().split())
        if a== 0 and b == 0:
            zab += 1
        elif b == 0:
            zb += 1
        elif a == 0:
            za += 1
        else:
            if a < 0:
                a = -a
                b = -b
            x = math.gcd(abs(a), abs(b))
            if (a//x, b//x) in d:
                d[(a//x, b//x)] += 1
            else:
                d[(a//x, b//x)] = 1
    used = set()
    l = []
    for x in d:
        if x in used:
            continue
        a, b = x[0], x[1]
        used.add(x)
        if a * b > 0:
            t = (abs(b), -abs(a))
            if t in d:
                used.add(t)
                l.append((d[x], d[t]))
            else:
                l.append((d[x], 0))
        else:
            t = (abs(b), abs(a))
            if t in d:
                used.add(t)
                l.append((d[x], d[t]))
            else:
                l.append((d[x], 0))
    r = pow(2, za) + pow(2, zb) - 1
    for i in l:
        r *= (pow(2, i[0]) + pow(2, i[1]) - 1)
        r %= mod
    return (r - 1 + zab) % mod
print(main())
# Buggy code:
from collections import defaultdict

def gcd(a, b):
    return gcd(b, a%b) if b else a

mod = 10 ** 9 + 7
N = int(input())
X = defaultdict(lambda: [0, 0])
print(X[(1, 1)])
# X = dict()
x = 0
y = 0
z = 0
for i in range(N):
    a, b = map(int, input().split())
    g = abs(gcd(a, b))
    if a * b > 0:
        X[(abs(a) / g, abs(b) / g)][0] += 1
    elif a * b < 0:
        X[(abs(b) / g, abs(a) / g)][1] += 1
    else:
        if a:
            x += 1
        elif b:
            y += 1
        else:
            z += 1
# suppose we have a super head point which can put togother with every point.
ans = 1
pow2 = [1]
for i in range(N):
    pow2 += [pow2[-1] * 2 % mod]
for i in X.values():
    ans *= pow2[i[0]] + pow2[i[1]]- 1
    ans %= mod
ans *= pow2[x] + pow2[y] - 1
print((ans+z-1)%mod)


# Fixed code:
from collections import defaultdict

def gcd(a, b):
    return gcd(b, a%b) if b else a

mod = 10 ** 9 + 7
N = int(input())
X = defaultdict(lambda: [0, 0])
# X = dict()
x = 0
y = 0
z = 0
for i in range(N):
    a, b = map(int, input().split())
    g = abs(gcd(a, b))
    if a * b > 0:
        X[(abs(a) // g, abs(b) // g)][0] += 1
    elif a * b < 0:
        X[(abs(b) // g, abs(a) // g)][1] += 1
    else:
        if a:
            x += 1
        elif b:
            y += 1
        else:
            z += 1
# suppose we have a super head point which can put togother with every point.
ans = 1
pow2 = [1]
for i in range(N):
    pow2 += [pow2[-1] * 2 % mod]
for i in X.values():
    ans *= pow2[i[0]] + pow2[i[1]]- 1
    ans %= mod
ans *= pow2[x] + pow2[y] - 1
print((ans+z-1)%mod)
# Buggy code:
mod = 10 ** 9 + 7
def gcd(a, b):
    return gcd(b, a%b) if b else a
N = int(input())
from collections import defaultdict
X = defaultdict(lambda: [0, 0])
x = 0
y = 0
z = 0
for i in range(N):
    a, b = map(int, input().split())
    g = abs(gcd(a, b))
    if a * b > 0:
        X[(abs(a) // g, abs(b) // g)][0] += 1
    elif a * b < 0:
        X[(abs(b) // g, abs(a) // g)][1] += 1
    else:
        if a:
            x += 1
        elif b:
            y += 1
        else:
            z += 1
print(X)
print(X.values())
ans = 1
pow2 = [1]
for i in range(N):
    pow2 += [pow2[-1] * 2 % mod]
for i in X.values():
    
    ans *= pow2[i[0]] + pow2[i[1]]- 1
    ans %= mod
ans *= pow2[x] + pow2[y] - 1
ans += z
ans %= mod
print(ans)


# Fixed code:
mod = 10 ** 9 + 7
from math import gcd
N = int(input())
from collections import defaultdict
X = defaultdict(lambda: [0, 0])
x = 0
y = 0
z = 0
for i in range(N):
  a, b = map(int, input().split())
  g = abs(gcd(a, b))
  if a * b > 0:
    X[(abs(a) // g, abs(b) // g)][0] += 1
  elif a * b < 0:
    X[(abs(b) // g, abs(a) // g)][1] += 1
  else:
    if a:
      x += 1
    elif b:
      y += 1
    else:
      z += 1
ans = 1
pow2 = [1]
for i in range(N):
  pow2 += [pow2[-1] * 2 % mod]
for i in X.values():
  ans *= pow2[i[0]] + pow2[i[1]]- 1
  ans %= mod
ans *= pow2[x] + pow2[y] - 1
ans += z - 1
ans %= mod
print(ans)
# Buggy code:
from collections import Counter
import sys
input = sys.stdin.readline

N = int(input())
AB = [[int(i) for i in input().split()] for _ in range(N)]

mod = 10 ** 9 + 7

def gcd(a, b) :
  if b > a : 
    a, b = b, a
  
  while b != 0 :
    a, b = b, a % b
  return a

p = []
zeroa = 0
zerob = 0
for a, b in AB :
  if a == 0 and b == 0 :
    continue
  elif a == 0 :
    zeroa += 1
    continue
  elif b == 0 :
    zerob += 1
    continue
    
  g = gcd(abs(a), abs(b))
  a //= g
  b //= g
  if a < 0 :
    a *= -1
    b *= -1
  p.append((a, b))

ret = 1
visited = set()
cnt = Counter(p)
for k, v in cnt.items() :
  a, b = k
  c, d = b, -a
  if c < 0 :
    c *= -1
    d *= -1
  if cnt[(c, d)] == 0 :
    ret *= pow(2, v, mod)
  else :
    if not (c, d) in visited :
      u = cnt[(c, d)]
      ret *= (pow(2, u, mod) + pow(2, v, mod) - 1)
      visited.add((a, b))
      visited.add((c, d))
  ret %= mod

ret *= pow(2, zeroa, mod) + pow(2, zerob, mod)
ret %= mod

print((ret - 1) % mod)

# Fixed code:
from collections import Counter
import sys
input = sys.stdin.readline

N = int(input())
AB = [[int(i) for i in input().split()] for _ in range(N)]

mod = 10 ** 9 + 7

def gcd(a, b) :
  if b > a : 
    a, b = b, a
  
  while b != 0 :
    a, b = b, a % b
  return a

p = []
both = 0
zeroa = 0
zerob = 0
for a, b in AB :
  if a == 0 and b == 0 :
    both += 1
    continue
  elif a == 0 :
    zeroa += 1
    continue
  elif b == 0 :
    zerob += 1
    continue
    
  g = gcd(abs(a), abs(b))
  a //= g
  b //= g
  if a < 0 :
    a *= -1
    b *= -1
  p.append((a, b))

ret = 1
visited = set()
cnt = Counter(p)
for k, v in cnt.items() :
  a, b = k
  c, d = b, -a
  if c < 0 :
    c *= -1
    d *= -1
  if cnt[(c, d)] == 0 :
    ret *= pow(2, v, mod)
  else :
    if not (c, d) in visited :
      u = cnt[(c, d)]
      ret *= (pow(2, u, mod) + pow(2, v, mod) - 1)
      visited.add((a, b))
      visited.add((c, d))
  ret %= mod

ret *= pow(2, zeroa, mod) + pow(2, zerob, mod) - 1
ret %= mod

print((ret - 1 + both) % mod)
# Buggy code:
import math
n = int(input())
from collections import defaultdict
d = defaultdict(list)
s = set()
zc = 0
for i in range(n):
    a,b = map(int, input().split())
    g = math.gcd(a,b)
    if g!=0:
        a //= g; b //= g
        if a<0:
            a,b = -a, -b
        elif b<0:
            b *= -1
        d[a,b].append(i)
    if a==b==0:
        zc += 1
v = 1
s = set()
M = 10**9+7
for (a,b),val in d.items():
    aa,bb = b,-a
    if aa<0:
        aa,bb = -aa, -bb
    elif bb<0:
        bb *= -1
    if (a,b) in s or (aa,bb) in s:
        continue
    if (aa,bb) in d.keys():
        v *= (pow(2, len(val), M) + pow(2, len(d[aa,bb]), M) - 1)
    else:
        v *= pow(2, len(val), M)
    v %= M
    s.add((a,b))
    s.add((aa,bb))
v -= 1
v += zc
print(v%M)

# Fixed code:
import math
n = int(input())
from collections import defaultdict
d = defaultdict(list)
s = set()
zc = 0
for i in range(n):
    a,b = map(int, input().split())
    g = math.gcd(a,b)
    if g!=0:
        a //= g; b //= g
        if a<0:
            a,b = -a, -b
        elif a==0 and b<0:
            b *= -1
        d[a,b].append(i)
    if a==b==0:
        zc += 1
v = 1
s = set()
M = 10**9+7
for (a,b),val in d.items():
    aa,bb = b,-a
    if aa<0:
        aa,bb = -aa, -bb
    elif aa==0 and bb<0:
        bb *= -1
    if (a,b) in s or (aa,bb) in s:
        continue
    if (aa,bb) in d.keys():
        v *= (pow(2, len(val), M) + pow(2, len(d[aa,bb]), M) - 1)
    else:
        v *= pow(2, len(val), M)
    v %= M
    s.add((a,b))
    s.add((aa,bb))
v -= 1
v += zc
print(v%M)
# Buggy code:
import sys
input = sys.stdin.readline
import math

mod = 10**9+7

N = int(input())
As = {}
Empty = 0
for _ in range(N):
    x, y = map(int, input().split())
    g = math.gcd(x, y)
    x, y = x//g, y//g
    if x == 0 and y == 0:
        Empty += 1
    else:
        if y < 0 or (y==0 and x < 0):
            y = -y
        if (x, y) in As:
            As[(x, y)] += 1
        else:
            As[(x, y)] = 1

M = N - Empty
ans = 1
for (x, y), num in As.items():
    if (-y, x) in As:
        if x > 0:
            ans = (ans * (pow(2, num, mod) + pow(2, As[(-y, x)], mod) - 1)) % mod
    elif not (y, -x) in As:
        ans = (ans * pow(2, num, mod)) % mod

print((ans-1)%mod)

# Fixed code:
import sys
input = sys.stdin.readline
import math

mod = 10**9+7

N = int(input())
As = {}
Empty = 0
for _ in range(N):
    x, y = map(int, input().split())
    g = math.gcd(x, y)
    if g == 0:
        Empty += 1
        continue
    x, y = x//g, y//g
    if y < 0 or (y==0 and x < 0):
        y = -y
        x = -x
    if (x, y) in As:
        As[(x, y)] += 1
    else:
        As[(x, y)] = 1

ans = 1
for (x, y), num in As.items():
    if (-y, x) in As:
        ans = (ans * (pow(2, num, mod) + pow(2, As[(-y, x)], mod) - 1)) % mod
    elif not (y, -x) in As:
        ans = (ans * pow(2, num, mod)) % mod

print((ans-1+Empty)%mod)
# Buggy code:
from collections import defaultdict
from math import gcd
import sys
input = sys.stdin.readline
N=int(input())
mod=10**9+7
dic=defaultdict(lambda: [0,0])
c=0
d=0
e=0
for i in [0]*N:
 A,B = map(int,input().split())
 if A==0 and B==0:
  e+=1
 elif A==0:
  c+=1
 elif B==0:
  d+=1
 else:
  g=gcd(A,B)
  A//=g
  B//g
  if A*B>0:
   dic[(A,B)][0]+=1
  else:
   dic[(-B,A)][1]+=1
ans=1
for k in dic:
 ans=ans*(pow(2,dic[k][0],mod)+pow(2,dic[k][1],mod) -1)
ans=ans*(pow(2,c,mod)+pow(2,d,mod)-1)
print((ans-1+e)%mod)

# Fixed code:
from collections import defaultdict
from math import gcd
import sys
input = sys.stdin.readline
N=int(input())
mod=10**9+7
dic=defaultdict(lambda: [0,0])
c=0
d=0
e=0
for i in [0]*N:
 A,B = map(int,input().split())
 if A==0 and B==0:
  e+=1
 elif A==0:
  c+=1
 elif B==0:
  d+=1
 else:
  g=gcd(A,B)
  A//=g
  B//=g
  if A*B>0:
   dic[(abs(A),abs(B))][0]+=1
  else:
   dic[(abs(B),abs(A))][1]+=1
ans=1
for k in dic:
 ans=ans*(pow(2,dic[k][0],mod)+pow(2,dic[k][1],mod) -1)
ans=ans*(pow(2,c,mod)+pow(2,d,mod)-1)
print((ans-1+e)%mod)
# Buggy code:
import sys
input=sys.stdin.buffer.readline
mod=10**9+7
n=int(input())
d={}
z=0
from math import gcd 
for i in range(n):
    x,y=map(int,input().split())
    if x==y==0:z+=1
    else:
        f=gcd(x,y)
        x//=f;y//=f
        if x<0:x*=-1;y*=-1
        if x==0 and y<0:y=-y
        d[(x,y)]+=1 if (x,y)in d else d[(x,y)]=1
ans=1
for (a,s) in d:
    if d[(a,s)]==0:continue
    ng=0
    if (s,-a)in d:ng+=d[(s,-a)];d[(s,-a)]=0
    if (-s,a)in d:ng+=d[(-s,a)];d[(-s,a)]=0
    ans*=(pow(2,d[(a,s)],mod)-1 + pow(2,ng,mod)-1 +1)%mod
    ans%=mod
    d[(a,s)]=0
print((ans+z-1)%mod)

# Fixed code:
import sys
input=sys.stdin.buffer.readline
mod=10**9+7
n=int(input())
d={}
z=0
from math import gcd 
for i in range(n):
    x,y=map(int,input().split())
    if x==y==0:z+=1
    else:
        f=gcd(x,y)
        x//=f;y//=f
        if x<0:x*=-1;y*=-1
        if x==0 and y<0:y=-y
        if (x,y)not in d:d[(x,y)]=1
        else:d[(x,y)]+=1
ans=1
for (a,s) in d:
    if d[(a,s)]==0:continue
    ng=0
    if (s,-a)in d:ng+=d[(s,-a)];d[(s,-a)]=0
    if (-s,a)in d:ng+=d[(-s,a)];d[(-s,a)]=0
    ans*=(pow(2,d[(a,s)],mod)-1 + pow(2,ng,mod)-1 +1)%mod
    ans%=mod
    d[(a,s)]=0
print((ans+z-1)%mod)