import sys

input = lambda : sys.stdin.readline().rstrip()

sys.setrecursionlimit(max(1000, 10**9))

write = lambda x: sys.stdout.write(x+"\n")







import bisect

from math import gcd

n = int(eval(input()))

l = [None] * n

for i in range(n):

    a,b = list(map(int, input().split()))

    g = gcd(a,b)

    if g==0:

        g = 1

    l[i] = (a//g, b//g)



l.sort()

M = 1000000007

seen = [False] * n

vals = []



def sub(item):

    item1 = (item[1], -item[0])

    item2 = (-item[1], item[0])

    tmp = None

    count = 0

    li = bisect.bisect_left(l, item1)

    ri = bisect.bisect_right(l, item1)

    count += (ri-li)

    for v in range(li, ri):

        seen[v] = True

    if ri>li:

        tmp = l[li]

        

    li = bisect.bisect_left(l, item2)

    ri = bisect.bisect_right(l, item2)

    count += (ri-li)

    for v in range(li, ri):

        seen[v] = True

    if ri>li:

        tmp = l[li]

    

    return count, tmp

zcount = 0

for i,item in enumerate(l):

    if seen[i]:

        continue

    elif item==(0,0):

        zcount += 1

        continue

    count,tmp = sub(item)

    if count>0:

        count2, tmp = sub(tmp)

        vals.append((pow(2,count,M)+pow(2,count2,M)-1)%M)

    else:

        vals.append(2)

ans = 1

for v in vals:

    ans *= v

    ans %= M

ans -= 1

ans = (ans+zcount) % M

print(ans)
import math

n = int(eval(input()))

from collections import defaultdict

d = defaultdict(list)

s = set()

zc = 0

for i in range(n):

    a,b = list(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 list(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 list(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))
import sys

input = lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x + "\n")
import bisect
from math import gcd

n = int(eval(input()))
l = [None] * n
for i in range(n):
    a, b = list(map(int, input().split()))
    g = gcd(a, b)
    if g == 0:
        g = 1
    l[i] = (a // g, b // g)
l.sort()
M = 1000000007
seen = [False] * n
vals = []


def sub(item):
    item1 = (item[1], -item[0])
    item2 = (-item[1], item[0])
    tmp = None
    count = 0
    li = bisect.bisect_left(l, item1)
    ri = bisect.bisect_right(l, item1)
    count += ri - li
    for v in range(li, ri):
        seen[v] = True
    if ri > li:
        tmp = l[li]
    li = bisect.bisect_left(l, item2)
    ri = bisect.bisect_right(l, item2)
    count += ri - li
    for v in range(li, ri):
        seen[v] = True
    if ri > li:
        tmp = l[li]
    return count, tmp


zcount = 0
for i, item in enumerate(l):
    if seen[i]:
        continue
    elif item == (0, 0):
        zcount += 1
        continue
    count, tmp = sub(item)
    if count > 0:
        count2, tmp = sub(tmp)
        vals.append((pow(2, count, M) + pow(2, count2, M) - 1) % M)
    else:
        vals.append(2)
ans = 1
for v in vals:
    ans *= v
    ans %= M
ans -= 1
ans = (ans + zcount) % M
print(ans)

import math

n = int(eval(input()))
from collections import defaultdict

d = defaultdict(list)
s = set()
zc = 0
for i in range(n):
    a, b = list(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 list(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 list(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))

-import sys - -input = lambda: sys.stdin.readline().rstrip() -sys.setrecursionlimit(max(1000, 10**9)) -write = lambda x: sys.stdout.write(x + "\n") -import bisect -from math import gcd +import math -l = [None] * n +from collections import defaultdict + +d = defaultdict(list) +s = set() +zc = 0 -    g = gcd(a, b) -    if g == 0: -        g = 1 -    l[i] = (a // g, b // g) -l.sort() -M = 1000000007 -seen = [False] * n -vals = [] - - -def sub(item): -    item1 = (item[1], -item[0]) -    item2 = (-item[1], item[0]) -    tmp = None -    count = 0 -    li = bisect.bisect_left(l, item1) -    ri = bisect.bisect_right(l, item1) -    count += ri - li -    for v in range(li, ri): -        seen[v] = True -    if ri > li: -        tmp = l[li] -    li = bisect.bisect_left(l, item2) -    ri = bisect.bisect_right(l, item2) -    count += ri - li -    for v in range(li, ri): -        seen[v] = True -    if ri > li: -        tmp = l[li] -    return count, tmp - - -zcount = 0 -for i, item in enumerate(l): -    if seen[i]: +    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 list(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: -    elif item == (0, 0): -        zcount += 1 -        continue -    count, tmp = sub(item) -    if count > 0: -        count2, tmp = sub(tmp) -        vals.append((pow(2, count, M) + pow(2, count2, M) - 1) % M) +    if (aa, bb) in list(d.keys()): +        v *= pow(2, len(val), M) + pow(2, len(d[aa, bb]), M) - 1 -        vals.append(2) -ans = 1 -for v in vals: -    ans *= v -    ans %= M -ans -= 1 -ans = (ans + zcount) % M -print(ans) +        v *= pow(2, len(val), M) +    v %= M +    s.add((a, b)) +    s.add((aa, bb)) +v -= 1 +v += zc +print((v % M))