qyliang/CodeNanoFix huggingface dataset:
# Buggy code:
import sys
from math import gcd
from collections import Counter

read = sys.stdin.read
readline = sys.stdin.readline

N, *AB = map(int, read().split())
mod = 10 ** 9 + 7

ab = []
zero = 0
for A, B in zip(*[iter(AB)] * 2):
    if A == 0 and B == 0:
        zero += 1
        continue
    if A == 0:
        B = -1
    elif B == 0:
        A = 1
    else:
        g = gcd(A, B)
        A //= g
        B //= g
    if A < 0:
        A, B = -A, -B
    ab.append((A, B))

cnt = Counter(ab)
answer = 1
checked = set()
ok = 0

for (i, j), n in cnt.items():
    if (i, j) in checked:
        continue
    if j < 0:
        c, d = -j, i
    else:
        c, d = j, -i
    if (c, d) in cnt:
        m = cnt[(c, d)]
        answer = (answer * (pow(2, n, mod) + pow(2, m, mod) - 1)) % mod
        checked.add((c, d))
    else:
        ok += n

answer *= pow(2, ok, mod)
answer %= mod
answer -= 1
answer += zero
print(answer+1)


# Fixed code:
import sys
from math import gcd
from collections import Counter

read = sys.stdin.read
readline = sys.stdin.readline

N, *AB = map(int, read().split())
mod = 10 ** 9 + 7

ab = []
zero = 0
for A, B in zip(*[iter(AB)] * 2):
    if A == 0 and B == 0:
        zero += 1
        continue
    if A == 0:
        B = -1
    elif B == 0:
        A = 1
    else:
        g = gcd(A, B)
        A //= g
        B //= g
    if A < 0:
        A, B = -A, -B
    ab.append((A, B))

cnt = Counter(ab)
answer = 1
checked = set()
ok = 0

for (i, j), n in cnt.items():
    if (i, j) in checked:
        continue
    if j < 0:
        c, d = -j, i
    else:
        c, d = j, -i
    if (c, d) in cnt:
        m = cnt[(c, d)]
        answer = (answer * (pow(2, n, mod) + pow(2, m, mod) - 1)) % mod
        checked.add((c, d))
    else:
        ok += n

answer *= pow(2, ok, mod)
answer -= 1
answer += zero
answer %= mod
print(answer)
# Buggy code:
from collections import defaultdict
import math
mod=1000000007
n=int(input())
dic=defaultdict(int)
x=[]
zerozero,azero,bzero=0,0,0
two=[1]

for i in range(n):
    two.append(two[-1]*2%mod)

for _ in range(n):
        
    a,b=map(int,input().split())
    if a==0 and b==0: zerozero+=1
    elif a==0: azero+=1
    elif b==0: bzero+=1
    else:
        k=math.gcd(a,b)
        a//=k;b//=k
        if a<0: a*=-1;b*=-1
        dic[(a,b)]+=1
        if a*b>0: dic[(b,-a)]+=0
        else: dic[(-b,a)]+=0

for (a,b) in dic:
    if a*b>0:
        x.append([ dic[(a,b)], dic[(b,-a)] ])
x.append([azero,bzero])
ans=1
for [p,q] in x:
    ans*=(two[p]+two[q]-1)
    ans%=mod
print(x)

print(ans-1)

# Fixed code:
def f():
    return [0,0]

from collections import defaultdict
import math
mod=1000000007
n=int(input())
dic=defaultdict(f)
x=[]
zerozero,azero,bzero=0,0,0
two=[1]

for i in range(n):
    two.append(two[-1]*2%mod)

for _ in range(n):
        
    a,b=map(int,input().split())
    if a==0 and b==0: zerozero+=1
    elif a==0: azero+=1
    elif b==0: bzero+=1
    else:
        k=math.gcd(a,b)
        a//=k;b//=k
        if a<0: a*=-1;b*=-1
        if a*b>0: dic[(a,b)][0]+=1
        else: dic[(-b,a)][1]+=1

for (a,b) in dic:
    x.append(dic[(a,b)])
x.append([azero,bzero])
ans=1
for [p,q] in x:
    ans*=(two[p]+two[q]-1)
    ans%=mod

print((ans-1+zerozero)%mod)
# Buggy code:
from sys import stdin, setrecursionlimit


def gcd(x, y):
    if x % y == 0:
        return y
    return gcd(y, x % y)


def main():
    mod = 10 ** 9 + 7
    input = stdin.buffer.readline
    n = int(input())
    p = []
    m = []

    zz = 0

    for _ in range(n):
        a, b = map(int, input().split())
        if a != 0 and b != 0:
            g = gcd(a, b)
            f = b / a
            if b / a < 0:
                m.append(-(a // g) / (b // g))
            elif f > 0:
                p.append((b // g) / (a // g))
        elif a == 0 and b == 0:
            zz += 1
        elif a == 0:
            m.append(0)
        elif b == 0:
            p.append(0)

    g_p = {}
    for k in p:
        if k in g_p:
            g_p[k] += 1
        else:
            g_p[k] = 1
    g_m = {}
    for k in m:
        if k in g_m:
            g_m[k] += 1
        else:
            g_m[k] = 1

    ans = 1

    for k in g_p:
        if k in g_m:
            ans *= (2 ** g_p[k] + 2 ** g_m[k] - 1)
        else:
            ans *= 2 ** g_p[k]
        ans %= mod
    for k in g_m:
        if not (k in g_p):
            ans *= 2 ** g_m[k]
            ans %= mod
    print((ans - 1) % mod + zz + 1)


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()


# Fixed code:
from sys import stdin, setrecursionlimit


def gcd(x, y):
    if x % y == 0:
        return y
    return gcd(y, x % y)


def main():
    mod = 10 ** 9 + 7
    input = stdin.buffer.readline
    n = int(input())
    p = []
    m = []

    zz = 0

    for _ in range(n):
        a, b = map(int, input().split())
        if a != 0 and b != 0:
            g = gcd(a, b)
            f = b / a
            if b / a < 0:
                m.append(str(abs(a // g)) + ':' + str(abs(b // g)))
            elif f > 0:
                p.append(str(abs((b // g))) + ':' + str(abs((a // g))))
        elif a == 0 and b == 0:
            zz += 1
        elif a == 0:
            m.append(0)
        elif b == 0:
            p.append(0)

    g_p = {}
    for k in p:
        if k in g_p:
            g_p[k] += 1
        else:
            g_p[k] = 1
    g_m = {}
    for k in m:
        if k in g_m:
            g_m[k] += 1
        else:
            g_m[k] = 1

    ans = 1

    for k in g_p:
        if k in g_m:
            ans *= (2 ** g_p[k] + 2 ** g_m[k] - 1)
        else:
            ans *= 2 ** g_p[k]
        ans %= mod
    for k in g_m:
        if not (k in g_p):
            ans *= 2 ** g_m[k]
            ans %= mod
    print((ans + zz - 1) % mod)


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()
# Buggy code:
from collections import defaultdict
from math import gcd
N = int(input())
MOD = 10**9 + 7
L = defaultdict(lambda: [0,0])
zero = 0
for _ in range(N):
    A, B = map(int, input().split())
    if A==0: d=B
    elif B==0: d=A
    else: d=gcd(A,B)
    if d != 0:
        A, B = A//d, B//d
        if A<0: A, B = -A, -B
        if B>0: L[(A,B)][0] += 1
        else: L[(-B,A)][1] += 1
    else: zero += 1
res = 1
print(L)
for x,y in L.values():
    res *= pow(2,x,MOD) + pow(2,y,MOD) -1
    res %= MOD
print(res + zero-1)

# Fixed code:
from collections import defaultdict
from math import gcd
N = int(input())
MOD = 10**9 + 7
L = defaultdict(lambda: [0,0])
zero = 0
for _ in range(N):
    A, B = map(int, input().split())
    if A==0: d=B
    elif B==0: d=A
    else: d=gcd(A,B)
    if d != 0:
        A, B = A//d, B//d
        if A<0: A, B = -A, -B
        if B>0: L[(A,B)][0] += 1
        else: L[(-B,A)][1] += 1
    else: zero += 1
res = 1
for x,y in L.values():
    res *= pow(2,x,MOD) + pow(2,y,MOD) -1
    res %= MOD
print((res+zero-1)%MOD)
# Buggy code:
#E
from fractions import gcd
N=int(input())

mod=1000000007
ans=1
P=dict()
M=dict()
zero=0
zero1=0
zero2=0
for i in range(N):
    a,b=map(int,input().split())
    if a==0 and b==0:
        zero+=1
    elif a==0 and b!=0:
        zero1+=1
    elif a!=0 and b==0:
        zero2+=1
    elif (a>0 and b<0) or (a<0 and b>0):
        GCD=gcd(abs(a),abs(b))
        a=abs(a)//GCD
        b=abs(b)//GCD
        s=str(a)+"/"+str(b)
        P[s]=P.get(s,0)+1
        
    else:
        GCD=gcd(abs(a),abs(b))
        a=abs(a)//GCD
        b=abs(b)//GCD
        s=str(b)+"/"+str(a)
        M[s]=M.get(s,0)+1

P["0/0"]=zero1
M["0/0"]=zero2
for v,cnt_p in P.items():
    if v in M:
        cnt_m=M[v]
        ans*=(2**cnt_p+2**cnt_m-1)
        M.pop(v)
    else:
        ans*=2**cnt_p
    ans%=mod
    
for v,cnt_m in M.items():
    ans*=2**cnt_m
    ans%=mod

ans-=1
ans+=zero
ans%=mod
print(ans)

# Fixed code:
#E
from math import gcd
N=int(input())

mod=1000000007
ans=1
P=dict()
M=dict()
zero=0
zero1=0
zero2=0
for i in range(N):
    a,b=map(int,input().split())
    if a==0 and b==0:
        zero+=1
    elif a==0 and b!=0:
        zero1+=1
    elif a!=0 and b==0:
        zero2+=1
    elif (a>0 and b<0) or (a<0 and b>0):
        GCD=gcd(abs(a),abs(b))
        a=abs(a)//GCD
        b=abs(b)//GCD
        s=str(a)+"/"+str(b)
        P[s]=P.get(s,0)+1
        
    else:
        GCD=gcd(abs(a),abs(b))
        a=abs(a)//GCD
        b=abs(b)//GCD
        s=str(b)+"/"+str(a)
        M[s]=M.get(s,0)+1

P["0/0"]=zero1
M["0/0"]=zero2
for v,cnt_p in P.items():
    if v in M:
        cnt_m=M[v]
        ans*=(2**cnt_p+2**cnt_m-1)
        M.pop(v)
    else:
        ans*=2**cnt_p
    ans%=mod
    
for v,cnt_m in M.items():
    ans*=2**cnt_m
    ans%=mod

ans-=1
ans+=zero
ans%=mod
print(ans)
# Buggy code:
import functools
MOD=10**9+7

def euclid(a, b):
  if b == 0:
    return a
  else:
    return euclid(b, a%b)

def gcd(nums):
  return functools.reduce(euclid, nums)

n=int(input())
t=[]
for i in range(n):
    a,b=map(int,input().split())
    t.append((a,b))
z=0
y={}
for i in range(n):
    if t[i][0]==0 and t[i][1]==0:
        z+=1
    else:
        g=abs(gcd([t[i][0],t[i][1]]))
        if t[i][1]==0:
            a=(1,0)
        elif t[i][1]>0:
            a=(t[i][0]//g , t[i][1]//g)
        else:
            a=(-t[i][0]//g , -t[i][1]//g)
        if a not in y:
            y[a]=1
        else:
            y[a]+=1

cnt=0
x=1
for i in y:
    if (-i[1],i[0]) in y:
        x  *= pow(2,y[(-i[1],i[0])],MOD) + pow(2,y[(i[0],i[1])],MOD)-1
        cnt+= y[(-i[1],i[0])] + y[(i[0],i[1])]

ans = pow(2,n-z-cnt,MOD) *x -1
print(x+z)

# Fixed code:
import functools
MOD=10**9+7

def euclid(a, b):
  if b == 0:
    return a
  else:
    return euclid(b, a%b)

def gcd(nums):
  return functools.reduce(euclid, nums)

n=int(input())
t=[]
for i in range(n):
    a,b=map(int,input().split())
    t.append((a,b))
z=0
y={}
for i in range(n):
    if t[i][0]==0 and t[i][1]==0:
        z+=1
    else:
        g=abs(gcd([t[i][0],t[i][1]]))
        if t[i][1]==0:
            a=(1,0)
        elif t[i][1]>0:
            a=(t[i][0]//g , t[i][1]//g)
        else:
            a=(-t[i][0]//g , -t[i][1]//g)
        if a not in y:
            y[a]=1
        else:
            y[a]+=1

cnt=0
x=1
for i in y:
    if (-i[1],i[0]) in y:
        x  *= pow(2,y[(-i[1],i[0])],MOD) + pow(2,y[(i[0],i[1])],MOD)-1
        cnt+= y[(-i[1],i[0])] + y[(i[0],i[1])]

ans = pow(2,n-z-cnt,MOD) *x -1
print((ans+z)%MOD)
# Buggy code:
from fractions import gcd
from collections import defaultdict as d
n=int(input())
m=10**9+7
s=d(lambda:[0,0])
p=-1
for i in range(n):
    a,b=map(int,input().split())
    if a==b==0:p+=1
    else:
        g=gcd(a,b)
        a=a//g
        b=b//g
        if a<0 or a==0<b:
            a,b=-a,-b
            if b<0:s[(a,-b)][1]+=1
            else:s[(a,b)][0]+=1
q=1
for i in s:
    k,l=s[i]
    q=q*(pow(k,2,m)+pow(l,2,m)-1)%m
print((q+p)%m)

# Fixed code:
from math import gcd
from collections import defaultdict as d
n=int(input())
m=10**9+7
s=d(lambda:[0,0])
p=-1
for i in range(n):
    a,b=map(int,input().split())
    if a==b==0:p+=1
    else:
        g=gcd(a,b)
        a=a//g
        b=b//g
        if a<0 or a==0<b:a,b=-a,-b
        if b<0:s[(-b,a)][1]+=1
        else:s[(a,b)][0]+=1
q=1
for i in s:
    k,l=s[i]
    q=q*(pow(2,k,m)+pow(2,l,m)-1)%m
print((q+p)%m)
# Buggy code:
from math import gcd 
n=int(input())
mod = 10**9+7
count = {}

for _ in range(n):
    a,b = map(int,input().split())
    if a==0 and b==0:
        continue
    if a*b != 0:
        g=gcd(a,b)*b//abs(b)
    elif a != 0:
        g=a
    else:
        g=b
        
    x=a//g,b//g
    count[x]=count.get(x,0)+1
        
mem=set()
ans=1
for (x,y),z in count.items():
    if (-1*x//abs(x)*y,abs(x)) in mem:
        continue
    mem.add((x,y))
    ans*=pow(2,z)+pow(2,count.get((-1*x//abs(x)*y,abs(x)),0)-1
    ans%=mod

print((ans-1)%mod)

# Fixed code:
from math import gcd 
n=int(input())
mod = 10**9+7
count = {}

num=0
for _ in range(n):
    a,b = map(int,input().split())
    if a==0 and b==0:
        num+=1
        continue
    if a*b != 0:
        g=gcd(a,b)*(b//abs(b))
    elif a != 0:
        g=a
    else:
        g=b
        
    l=a//g,b//g
    count[l]=count.get(l,0)+1
        
mem=set()
ans=1
for (x,y),z in count.items():
    if x*y==0:
        k=(y,x)
    else:
        k=(-1*x//abs(x)*y,abs(x))
    if k in mem:
        continue
    mem.add((x,y))
    ans*=(pow(2,z)+pow(2,count.get(k,0))-1)
    ans%=mod

print((ans+num-1)%mod)
# Buggy code:
import math


n = int(input())
mod = 1000000007
ab = [list(map(int,input().split())) for _ in range(n)]
dic = {}
z = 0
nz,zn = 0,0
for a,b in ab:
    if a == 0 and b == 0:
        z += 1
        continue
    elif a == 0:
        zn += 1
        continue
    elif b == 0:
        nz += 1
    if a< 0:
        a = -a
        b = -b
    g = math.gcd(a,b)
    tp = (a//g,b//g)
    if tp not in dic:
        dic[tp] = 1
    else:
        dic[tp] += 1
    
ans = 1
nn = n - z - zn - nz
for tp,v in dic.items():
    if v == 0:
        continue
    vt = (tp[1],-1*tp[0])
    if vt in dic:
        w = dic[vt]
        #print(tp)
        e = pow(2,v,mod) + pow(2,w,mod) - 1
        ans *= e
        ans %= mod
        nn -= v + w 
        dic[tp] = 0
        dic[vt] = 0
ans *= pow(2,nn,mod)
ans += z
if zn == 0:
    ans *= pow(2,nz,mod)
elif nz == 0:
    ans *= pow(2,zn,mod)
else:
    ans *= pow(2,nz,mod) + pow(2,zn,mod) - 1
print(ans%mod)
#print(dic)


# Fixed code:
import math


n = int(input())
mod = 1000000007
ab = [list(map(int,input().split())) for _ in range(n)]
dic = {}
z = 0
nz,zn = 0,0
for a,b in ab:
    if a == 0 and b == 0:
        z += 1
        continue
    elif a == 0:
        zn += 1
        continue
    elif b == 0:
        nz += 1
    if a< 0:
        a = -a
        b = -b
    g = math.gcd(a,b)
    tp = (a//g,b//g)
    if tp not in dic:
        dic[tp] = 1
    else:
        dic[tp] += 1
    
ans = 1
nn = n - z - zn - nz
for tp,v in dic.items():
    if v == 0:
        continue
    vt = (tp[1],-1*tp[0])
    if vt in dic:
        w = dic[vt]
        #print(tp)
        e = pow(2,v,mod) + pow(2,w,mod) - 1
        ans *= e
        ans %= mod
        nn -= v + w 
        dic[tp] = 0
        dic[vt] = 0
ans *= pow(2,nn,mod)
if zn == 0:
    ans *= pow(2,nz,mod)
elif nz == 0:
    ans *= pow(2,zn,mod)
else:
    ans *= pow(2,nz,mod) + pow(2,zn,mod) - 1
ans += z - 1
print(ans%mod)
#print(dic)
# Buggy code:
from math import gcd 
from collections import defaultdict

def to_irreducible(a, b):
    if a == 0:
        return (0, 1)
    GCD = gcd(a, b)
    return (a//GCD, b//GCD)

MOD = 10**9 + 7
N = int(input())
quadrant1 = defaultdict(int)
quadrant2 = defaultdict(int)
zero_cases = 0

for i in range(N):
    a, b = map(int, input().split())
    irr = to_irreducible(abs(a), abs(b))
    if a == 0 and b == 0:
        zero_cases += 1
    elif a * b >= 0 and b != 0:
        quadrant1[irr] += 1
    else:
        quadrant2[reversed(irr)] += 1
        quadrant1[reversed(irr)] += 0

ans = 1 
for key, v1 in quadrant1.items():
    v2 = quadrant2[key]
    ans *= (2**v1 + 2**v2 -1)
    ans %= MOD
print((ans+zero_cases-1) % MOD)

# Fixed code:
from math import gcd 
from collections import defaultdict

def to_irreducible(a, b):
    if a == 0:
        return (0, 1)
    GCD = gcd(a, b)
    return (a//GCD, b//GCD)

MOD = 10**9 + 7
N = int(input())
quadrant1 = defaultdict(int)
quadrant2 = defaultdict(int)
zero_cases = 0

for i in range(N):
    a, b = map(int, input().split())
    if a == 0 and b == 0:
        zero_cases += 1
    elif a * b >= 0 and b != 0:
        irr = to_irreducible(abs(a), abs(b))
        quadrant1[irr] += 1
    else:
        irr = to_irreducible(abs(b), abs(a))
        quadrant2[irr] += 1
        quadrant1[irr] += 0

ans = 1 
for key, v1 in quadrant1.items():
    v2 = quadrant2[key]
    ans *= (2**v1 + 2**v2 -1)
    ans %= MOD
print((ans+zero_cases-1) % MOD)
# Buggy code:
from sys import stdin
from collections import defaultdict
from math import gcd


def main():
    MOD = 1000000007

    N, *AB = map(int, stdin.buffer.read().split())

    d = defaultdict(int)
    n_zeros = 0

    for a, b in zip(AB[::2], AB[1::2]):
        if a == 0 and b == 0:
            n_zeros += 1
            continue

        g = gcd(a, b)
        a, b = a // g, b // g

        if a * b > 0 or b == 0:
            c = (abs(a), abs(b))
        else:
            c = (-abs(b), -abs(a))

        d[c] += 1

    ans = 1
    n_not_paired = 0
    for ab, n in d.items():
        ab_pair = (-ab[1], -ab[0])
        if ab_pair in d:
            if ab[0] > 0:
                ans = ans * (pow(2, n, MOD) + pow(2, m, MOD) - 1) % MOD
        else:
            n_not_paired += n

    ans = (ans * pow(2, n_not_paired, MOD) + n_zeros - 1) % MOD
    print(ans)


if __name__ == '__main__':
    main()


# Fixed code:
from sys import stdin
from collections import defaultdict
from math import gcd


def main():
    MOD = 1000000007

    N, *AB = map(int, stdin.buffer.read().split())

    d = defaultdict(int)
    n_zeros = 0

    for a, b in zip(AB[::2], AB[1::2]):
        if a == 0 and b == 0:
            n_zeros += 1
            continue

        g = gcd(a, b)
        a, b = a // g, b // g

        if a * b > 0 or b == 0:
            c = (abs(a), abs(b))
        else:
            c = (-abs(a), -abs(b))

        d[c] += 1

    ans = 1
    n_not_paired = 0
    for ab, n in d.items():
        ab_pair = (-ab[1], -ab[0])
        if ab_pair in d:
            if ab[0] > 0:
                m = d[ab_pair]
                ans = ans * (pow(2, n, MOD) + pow(2, m, MOD) - 1) % MOD
        else:
            n_not_paired += n

    ans = (ans * pow(2, n_not_paired, MOD) + n_zeros - 1) % MOD
    print(ans)


if __name__ == '__main__':
    main()
# Buggy code:
import collections
import math

n = int(input())
m = 0
mod = 10 ** 9 + 7
c = []
d = []
frac = []

for _ in range(n):
    a, b = map(int, input().split())
    if a == 0 and b == 0:
        n -= 1
        m += 1
        continue
    if a == 0:
        frac.append('0/1')
    elif b == 0:
        frac.append(('1/0'))
    else:
        gcd = abs(math.gcd(a, b))
        sign = 1 if a * b > 0 else -1
        a = sign * abs(a) // gcd
        b = abs(b) // gcd
        frac.append('{}/{}'.format(a, b))

frac = collections.Counter(frac)
print(frac)

def inverse(key):
    if key == '0/1':
        return '1/0'
    elif key == '1/0':
        return '0/1'
    elif key[0] != '-':
        a, b = key.split('/')
        return '-{}/{}'.format(b, a)
    else:
        a, b = key[1:].split('/')
        return '{}/{}'.format(b, a)

for key, value in frac.items():
    if key[0] == '-' or key[0] == '0': continue
    if frac[inverse(key)] > 0:
        c.append(value)
        d.append(frac[inverse(key)])

ans = pow(2, n - sum(c) - sum(d), mod)
for i, j in zip(c, d):
    tmp = (pow(2, i, mod) + pow(2, j, mod) - 1)
    ans = (ans * (pow(2, i, mod) + pow(2, j, mod) - 1)) % mod
ans = (ans - 1 + m) % mod

print(ans)


# Fixed code:
import collections
import math

n = int(input())
m = 0
mod = 10 ** 9 + 7
c = []
d = []
frac = []

for _ in range(n):
    a, b = map(int, input().split())
    if a == 0 and b == 0:
        n -= 1
        m += 1
        continue
    if a == 0:
        frac.append('0/1')
    elif b == 0:
        frac.append(('1/0'))
    else:
        gcd = abs(math.gcd(a, b))
        sign = 1 if a * b > 0 else -1
        a = sign * abs(a) // gcd
        b = abs(b) // gcd
        frac.append('{}/{}'.format(a, b))

frac = collections.Counter(frac)

def inverse(key):
    if key == '0/1':
        return '1/0'
    elif key == '1/0':
        return '0/1'
    elif key[0] != '-':
        a, b = key.split('/')
        return '-{}/{}'.format(b, a)
    else:
        a, b = key[1:].split('/')
        return '{}/{}'.format(b, a)

for key, value in frac.items():
    if key[0] == '-' or key[0] == '0': continue
    if frac[inverse(key)] > 0:
        c.append(value)
        d.append(frac[inverse(key)])

ans = pow(2, n - sum(c) - sum(d), mod)
for i, j in zip(c, d):
    tmp = (pow(2, i, mod) + pow(2, j, mod) - 1) % mod
    ans = ans * tmp % mod
ans = (ans - 1 + m) % mod

print(ans)
# Buggy code:
n = int(input())
ab = []
for _ in range(n):
    a, b = map(int, input().split())
    ab.append((a, b))
di = {}
def gcd(a, b):
    while b!=0:
        a, b = b, a%b
    return a
for a, b in ab:
    if a*b!=0:
        g = gcd(abs(a), abs(b))
        a, b = a//g, b//g
    if a*b>0:
        ind = (abs(a), abs(b))
    elif a*b<0:
        ind = (abs(b), abs(a))
    else:
        ind = 0
    if ind in di:
        x, y = di[ind]
    else:
        x = y = 0
    if a*b==0:
        if b!=0:
            di[ind] = (x+1, y)
        elif a!=0:
            di[ind] = (x, y+1)
    else:
        if a*b>0:
            di[ind] = (x+1, y)
        else:
            di[ind] = (x, y+1)
print(di)
mod = 10**9+7
ans = 1
for i, j in di.values():
    ans *= (pow(2, i, mod)+pow(2, j, mod)-1)
    ans %= mod
print((ans-1)%mod)

# Fixed code:
n = int(input())
ab = []
for _ in range(n):
    a, b = map(int, input().split())
    ab.append((a, b))
di = {}
z = 0
def gcd(a, b):
    while b!=0:
        a, b = b, a%b
    return a
for a, b in ab:
    if a*b!=0:
        g = gcd(abs(a), abs(b))
        a, b = a//g, b//g
    if a*b>0:
        ind = (abs(a), abs(b))
    elif a*b<0:
        ind = (abs(b), abs(a))
    else:
        ind = 0
    if ind in di:
        x, y = di[ind]
    else:
        x = y = 0
    if a*b==0:
        if b!=0:
            di[ind] = (x+1, y)
        elif a!=0:
            di[ind] = (x, y+1)
        else:
            z += 1
    else:
        if a*b>0:
            di[ind] = (x+1, y)
        else:
            di[ind] = (x, y+1)
mod = 10**9+7
ans = 1
for i, j in di.values():
    ans *= (pow(2, i, mod)+pow(2, j, mod)-1)
    ans %= mod
print((ans+z-1)%mod)
# Buggy code:
from math import gcd

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

t = []
d = {}
d[0][0] = 0
for a, b in AB:
    i = gcd(a, b)
    if i != 0:
        a //= i
        b //= i
    t.append((a, b))
    d.setdefault(a, {})
    d[a].setdefault(b, 0)
    d[a][b] += 1

used = set()
result = 1
for a, b in t:
    if (a, b) in used:
        continue
    used.add((a, b))
    if a == 0 and b == 0:
        continue
    i = d[a][b]
    j, k, l = 0, 0, 0
    if -a in d and -b in d[-a]:
        j = d[-a][-b]
        used.add((-a, -b))
    if -b in d and a in d[-b]:
        k = d[-b][a]
        used.add((-b, a))
    if b in d and -a in d[b]:
        l = d[b][-a]
        used.add((b, -a))
    result *= pow(2, i + j, 1000000007) + pow(2, k + l, 1000000007) - 1
    result %= 1000000007
print(result + d[0][0] - 1)


# Fixed code:
from math import gcd

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

t = []
d = {}
d[0] = {}
d[0][0] = 0
for a, b in AB:
    i = gcd(a, b)
    if i != 0:
        a //= i
        b //= i
    t.append((a, b))
    d.setdefault(a, {})
    d[a].setdefault(b, 0)
    d[a][b] += 1

used = set()
result = 1
for a, b in t:
    if (a, b) in used:
        continue
    used.add((a, b))
    if a == 0 and b == 0:
        continue
    i = d[a][b]
    j, k, l = 0, 0, 0
    if -a in d and -b in d[-a]:
        j = d[-a][-b]
        used.add((-a, -b))
    if -b in d and a in d[-b]:
        k = d[-b][a]
        used.add((-b, a))
    if b in d and -a in d[b]:
        l = d[b][-a]
        used.add((b, -a))
    result *= pow(2, i + j, 1000000007) + pow(2, k + l, 1000000007) - 1
    result %= 1000000007
result += d[0][0] - 1
result %= 1000000007
print(result)