CodeEff/ECCO huggingface dataset:
# Original solution
def main():
  from fractions import Fraction
  import sys
  input = sys.stdin.readline
  N = int(eval(input()))
  AB = [list(map(int,input().split())) for _ in range(N)]

  MOD = 10**9 + 7

  zero_zero_count = 0
  zero_one_count = 0
  one_zero_count = 0
  dd_ba = {}
  dd_flag = {}
  for a,b in AB:
    if (a==0)and(b==0):
      zero_zero_count += 1
    elif (a==0):
      zero_one_count += 1
    elif (b==0):
      one_zero_count += 1
    else:
      ba = Fraction(-b, a)
      ab = Fraction(a, b)
      if ba in dd_ba:
        dd_ba[ba] += 1
      else:
        dd_ba[ba] = 1
      
      if not(ab in dd_ba):
        dd_ba[ab] = 0
        
      dd_flag[ba] = False
      dd_flag[ab] = False

  ans = (2**zero_one_count + 2**one_zero_count -1)

  for key,value in tuple(dd_ba.items()):
    if dd_flag[key]:
      continue
    x = Fraction(key.denominator, -(key.numerator))
    y = dd_ba[x]
    ans *= (2**y + 2**value - 1) % MOD
    ans %= MOD
    dd_flag[x] = True

  ans += zero_zero_count - 1
  print((ans%MOD)) 

if __name__=='__main__':
  main()

# Optimized solution
def main():
  from math import gcd
  from collections import defaultdict
  import sys
  input = sys.stdin.readline
  N = int(eval(input()))
  AB = [list(map(int,input().split())) for _ in range(N)]

  MOD = 10**9 + 7

  zero_zero_count = 0
  zero_one_count = 0
  one_zero_count = 0
  dd_ba = defaultdict(int, {})
  for a,b in AB:
    if (a==0)and(b==0):
      zero_zero_count += 1
    elif (a==0):
      zero_one_count += 1
    elif (b==0):
      one_zero_count += 1
    else:
      if a * b < 0:
        a = abs(a)
        b = abs(b)
        g = gcd(a, b)
        dd_ba[(b//g, a//g)] += 1
      else:
        a = abs(a)
        b = abs(b)
        g = gcd(a, b)
        dd_ba[(-b//g, a//g)] += 1

  ans = (2**zero_one_count + 2**one_zero_count -1)
  dd_flag = defaultdict(bool, {})

  for key,value in tuple(dd_ba.items()):
    if dd_flag[key]:
      continue
    
    key_0 = key[0]
    key_1 = key[1]
    if key_0<0:
      x = (key_1, -key_0)
    else:
      x = (-key_1, key_0)
    y = dd_ba[x]
    ans *= (2**y + 2**value - 1) % MOD
    ans %= MOD
    dd_flag[x] = True

  ans += zero_zero_count - 1
  print((ans%MOD)) 

if __name__=='__main__':
  main()
# Original solution
from fractions import Fraction as F
MOD = 10**9 + 7


def main(N, T):
    A = []
    cnt_zero = [0, 0]  # 片方が0のとき
    p = 0  # 両方0
    cA = {}
    for a, b in T:
        if a == 0 and b == 0:
            p += 1
        elif a == 0:
            cnt_zero[0] += 1
        elif b == 0:
            cnt_zero[1] += 1
        else:
            A.append((F(a, b), F(b, a)))
            if F(a, b) not in list(cA.keys()):
                cA[F(a, b)] = 0
            if -F(b, a) not in list(cA.keys()):
                cA[-F(b, a)] = 0
            cA[F(a, b)] += 1

    used = set()
    ans = 1
    ans *= pow(2, cnt_zero[0], MOD) - 1 + pow(2, cnt_zero[1], MOD) - 1 + 1
    for a, b in A:
        if a in used or -b in used:
            continue
        ans *= pow(2, cA[a], MOD) - 1 + pow(2, cA[-b], MOD) - 1 + 1
        ans %= MOD
        used.add(a)
        used.add(-b)
    print(((ans + p - 1) % MOD))


if __name__ == '__main__':

    N = int(eval(input()))
    T = [[int(i) for i in input().split()] for j in range(N)]
    main(N, T)


# Optimized solution
MOD = 10**9 + 7
P = 7 ** 21 + 52


def F(a, b):
    return (a * pow(b, P-2, P)) % P


def main():
    from collections import Counter
    import sys
    input = sys.stdin.buffer.readline
    N = int(eval(input()))
    T = [[int(i) for i in input().split()] for j in range(N)]
    A = []
    cnt_zero = [0, 0]  # 片方が0のとき
    p = 0  # 両方0
    cA = Counter()
    for a, b in T:
        if a == 0 and b == 0:
            p += 1
        elif a == 0:
            cnt_zero[0] += 1
        elif b == 0:
            cnt_zero[1] += 1
        else:
            A.append((F(a, b), -F(b, a) % P))
            cA[F(a, b)] += 1

    used = set()
    ans = 1
    ans *= pow(2, cnt_zero[0], MOD) - 1 + pow(2, cnt_zero[1], MOD) - 1 + 1
    for a, b in A:
        if a in used or b in used:
            continue
        ans *= pow(2, cA[a], MOD) - 1 + pow(2, cA[b], MOD) - 1 + 1
        ans %= MOD
        used.add(a)
        used.add(b)
    print(((ans + p - 1) % MOD))


if __name__ == '__main__':
    main()
# Original solution
MOD = 10**9 + 7
P = 7 ** 21 + 52


def F(a, b):
    return (a * pow(b, P-2, P)) % P


def main():
    from collections import Counter
    import sys
    input = sys.stdin.buffer.readline
    N = int(eval(input()))
    T = [[int(i) for i in input().split()] for j in range(N)]
    A = []
    cnt_zero = [0, 0]  # 片方が0のとき
    p = 0  # 両方0
    cA = Counter()
    for a, b in T:
        if a == 0 and b == 0:
            p += 1
        elif a == 0:
            cnt_zero[0] += 1
        elif b == 0:
            cnt_zero[1] += 1
        else:
            A.append((F(a, b), -F(b, a) % P))
            cA[F(a, b)] += 1

    used = set()
    ans = 1
    ans *= pow(2, cnt_zero[0], MOD) - 1 + pow(2, cnt_zero[1], MOD) - 1 + 1
    for a, b in A:
        if a in used or b in used:
            continue
        ans *= pow(2, cA[a], MOD) - 1 + pow(2, cA[b], MOD) - 1 + 1
        ans %= MOD
        used.add(a)
        used.add(b)
    print(((ans + p - 1) % MOD))


if __name__ == '__main__':
    main()


# Optimized solution
MOD = 10**9 + 7
P = 7 ** 21 + 52


def F(a, b):
    return (a * pow(b, P-2, P)) % P


def main():
    from collections import Counter
    import sys
    input = sys.stdin.buffer.readline
    N = int(eval(input()))
    T = [[int(i) for i in input().split()] for j in range(N)]
    cnt_zero = [0, 0]  # 片方が0のとき
    p = 0  # 両方0
    cA = Counter()
    B = []
    used = set()
    for a, b in T:
        if a == 0 and b == 0:
            p += 1
        elif a == 0:
            cnt_zero[0] += 1
        elif b == 0:
            cnt_zero[1] += 1
        else:
            x = F(a, b)
            y = -F(b, a) % P
            cA[x] += 1
            if x not in used and y not in used:
                B.append((x, y))
                used.add(x)
                used.add(y)

    ans = 1
    ans *= pow(2, cnt_zero[0], MOD) - 1 + pow(2, cnt_zero[1], MOD) - 1 + 1
    for a, b in B:
        ans *= pow(2, cA[a], MOD) - 1 + pow(2, cA[b], MOD) - 1 + 1
        ans %= MOD
    print(((ans + p - 1) % MOD))


if __name__ == '__main__':
    main()
# Original solution
from math import gcd

MOD = 10**9+7
N = int(eval(input()))
d = {}
zero = 0
for i in range(N):
    a, b = list(map(int, input().split()))
    if a == 0 and b == 0:
        zero += 1
        continue

    flip = 0
    while not (a > 0 and b >= 0):
        a, b = -b, a
        flip ^= 1

    g = gcd(a, b)
    a //= g
    b //= g
    if not (a, b) in d:
        d[(a, b)] = [0, 0]
    d[(a, b)][flip] += 1

ans = 1
for (v1, v2) in list(d.values()):
    ans *= pow(2, v1, MOD) + pow(2, v2, MOD)-1
    ans %= MOD
ans -= 1
ans += zero
ans %= MOD
print(ans)


# Optimized solution
from math import gcd

MOD = 10**9+7
N = int(eval(input()))
d = {}
zero = 0
for i in range(N):
    a, b = list(map(int, input().split()))
    if a == 0 and b == 0:
        zero += 1
        continue

    flip = 0
    while not (a >= 0 and b > 0):
        a, b = -b, a
        flip ^= 1

    g = gcd(a, b)
    a //= g
    b //= g
    if not (a, b) in d:
        d[(a, b)] = [0, 0]
    d[(a, b)][flip] += 1

ans = 1
for (v1, v2) in list(d.values()):
    ans *= pow(2, v1, MOD) + pow(2, v2, MOD)-1
    ans %= MOD
ans -= 1
ans += zero
ans %= MOD
print(ans)
# Original solution
from math import gcd

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

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

used = set()
result = 1
for a, b in t:
    if (a, b) in used:
        continue
    used.add((a, b))
    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)


# Optimized solution
from math import gcd

N = int(eval(input()))
AB = [list(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
t = set(t)
if (0, 0) in t:
    t.remove((0, 0))

used = set()
result = 1
for a, b in t:
    if (a, b) in used:
        continue
    used.add((a, b))
    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)
# Original solution
from math import gcd

N = int(eval(input()))
AB = [list(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
t = set(t)
if (0, 0) in t:
    t.remove((0, 0))

used = set()
result = 1
for a, b in t:
    if (a, b) in used:
        continue
    used.add((a, b))
    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)


# Optimized solution
from math import gcd

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

m = 1000000007

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, m) + pow(2, k + l, m) - 1
    result %= m
result += d[0][0] - 1
result %= m
print(result)
# Original solution
import collections
from math import gcd
import sys
input=sys.stdin.readline
n=int(eval(input()))
c=collections.Counter()
mod=10**9+7
for _ in range(n):
    a,b=list(map(int,input().split()))
    g=abs(gcd(a,b))
    if g==0:
        g=1
    a//=g
    b//=g
    c[(a,b)]+=1
ans=1
s=set()
for i,j in c:
    if (i,j)==(0,0):
        continue
    if (i,j) not in s:
        s.add((i,j))
        s.add((-i,-j))
        s.add((-j,i))
        s.add((j,-i))
        ans*=(pow(2,c[(i,j)]+c[(-i,-j)],mod)+pow(2,c[(j,-i)]+c[(-j,i)],mod)-1)%mod
print(((ans-1+c[(0,0)])%mod))


# Optimized solution
import collections
from math import gcd
def main():
    n=int(eval(input()))
    c=collections.Counter()
    mod=10**9+7
    for _ in range(n):
        a,b=list(map(int,input().split()))
        g=abs(gcd(a,b))
        if g==0:
            g=1
        a//=g
        b//=g
        c[(a,b)]+=1
    ans=1
    s=set()
    for i,j in c:
        if (i,j)==(0,0):
            continue
        if (i,j) not in s:
            s.add((i,j))
            s.add((-i,-j))
            s.add((-j,i))
            s.add((j,-i))
            ans*=(pow(2,c[(i,j)]+c[(-i,-j)],mod)+pow(2,c[(j,-i)]+c[(-j,i)],mod)-1)%mod
    print(((ans-1+c[(0,0)])%mod))

if __name__ == "__main__":
    main()
# Original solution
from fractions import Fraction
import math

n = int(eval(input()))


ab = []
ba = []

a0 = 0
b0 = 0
ab0 = 0

for i in range(n):
    a, b = list(map(int, input().split()))
    if a != 0 and b != 0:
        ab.append(Fraction(a, b))
        ba.append(Fraction(-b, a))
    elif a == 0 and b == 0:
        ab0 += 1
    elif a == 0 and b != 0:
        a0 += 1
    elif a != 0 and b == 0:
        b0 += 1


d_ab = dict()
d_ba = dict()

# d_done = dict()

for i in range(len(ab)):
    cur = ab[i]
    if cur in d_ab:
        d_ab[cur] += 1
    else:
        d_ab[cur] = 1

    cur = ba[i]
    if cur in d_ba:
        d_ba[cur] += 1
    else:
        d_ba[cur] = 1

mod = 1000000007
ans = 1

d_done = set()

for k, v in list(d_ab.items()):
    x = v
    if k in d_ba:
        if k in d_done:
            continue
        else:
            y = d_ba[k]
            kake = 0
            kake += ((2**x) % mod + (2**y) % mod - 1)
            ans *= kake
            ans %= mod
            # d_done[Fraction(-k.denominator, k.numerator)] = 1
            d_done.add(Fraction(-k.denominator, k.numerator))
    else:
        kake = (2**x) % mod
        ans *= kake
        ans %= mod

ans *= ((2**a0) % mod+(2**b0) % mod-1)
ans %= mod

ans -= 1

ans += ab0
ans %= mod

print(ans)


# Optimized solution
from fractions import Fraction
import math

n = int(eval(input()))


ab = []
ba = []

a0 = 0
b0 = 0
ab0 = 0


def irr(a, b):
    gcd = math.gcd(a, b)
    a = a // gcd
    b = b // gcd

    if b < 0:
        return (-a, -b)
    else:
        return (a, b)


for i in range(n):
    a, b = list(map(int, input().split()))
    if a != 0 and b != 0:
        ab.append(irr(a, b))
        ba.append(irr(-b, a))
    elif a == 0 and b == 0:
        ab0 += 1
    elif a == 0 and b != 0:
        a0 += 1
    elif a != 0 and b == 0:
        b0 += 1


d_ab = dict()
d_ba = dict()

# d_done = dict()

for i in range(len(ab)):
    cur = ab[i]
    if cur in d_ab:
        d_ab[cur] += 1
    else:
        d_ab[cur] = 1

    cur = ba[i]
    if cur in d_ba:
        d_ba[cur] += 1
    else:
        d_ba[cur] = 1

mod = 1000000007
ans = 1

d_done = set()

for k, v in list(d_ab.items()):
    x = v
    if k in d_ba:
        if k in d_done:
            continue
        else:
            y = d_ba[k]
            kake = 0
            kake += ((2**x) % mod + (2**y) % mod - 1)
            ans *= kake
            ans %= mod
            # d_done[Fraction(-k.denominator, k.numerator)] = 1
            d_done.add(irr(-k[1], k[0]))
    else:
        kake = (2**x) % mod
        ans *= kake
        ans %= mod

ans *= ((2**a0) % mod+(2**b0) % mod-1)
ans %= mod

ans -= 1

ans += ab0
ans %= mod

print(ans)
# Original solution
from fractions import Fraction
from collections import defaultdict


def inverse(key):
    if key == "inf":
        return Fraction(0, 1)

    if key == Fraction(0, 1):
        return "inf"

    return - Fraction(key.denominator, key.numerator)


mod = 10 ** 9 + 7
n = int(eval(input()))
fishes = defaultdict(int)

zero_zero = 0
for _ in range(n):
    a, b = list(map(int, input().split()))
    if a == 0 and b == 0:
        zero_zero += 1
        continue

    elif b == 0:
        key = "inf"

    else:
        key = Fraction(a, b)

    fishes[key] += 1

ans = 1
counted_key = set()
for fish_key, count in list(fishes.items()):
    if fish_key in counted_key:
        continue

    bad_pair = inverse(fish_key)
    if bad_pair in fishes:
        pair_count = fishes[bad_pair]
        pattern = pow(2, count, mod) + pow(2, pair_count, mod) - 1
        counted_key.add(bad_pair)

    else:
        pattern = pow(2, count, mod)

    ans = ans * pattern % mod

if zero_zero:
    ans += zero_zero

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


# Optimized solution
from collections import defaultdict
from math import gcd

mod = 10 ** 9 + 7
n = int(eval(input()))
fishes = defaultdict(int)
zero_zero = 0
zero = 0
inf = 0

for _ in range(n):
    a, b = list(map(int, input().split()))
    if a == 0 and b == 0:
        zero_zero += 1

    elif a == 0:
        zero += 1

    elif b == 0:
        inf += 1

    else:
        div = gcd(a, b)
        a //= div
        b //= div
        if b < 0:
            a *= -1
            b *= -1
        key = (a, b)
        fishes[key] += 1


def get_bad_pair(fish):
    a, b = fish
    if a < 0:
        a *= -1
        b *= -1
    return (-b, a)


ans = 1
counted_key = set()
for fish_key, count in list(fishes.items()):
    if fish_key in counted_key:
        continue

    bad_pair = get_bad_pair(fish_key)
    if bad_pair in fishes:
        pair_count = fishes[bad_pair]
        pattern = pow(2, count, mod) + pow(2, pair_count, mod) - 1
        counted_key.add(bad_pair)

    else:
        pattern = pow(2, count, mod)

    ans = ans * pattern % mod

ans *= pow(2, zero, mod) + pow(2, inf, mod) - 1
if zero_zero:
    ans += zero_zero

ans -= 1
print((ans % mod))
# Original solution
from collections import defaultdict
from math import gcd

mod = 10 ** 9 + 7
n = int(eval(input()))
fishes = defaultdict(int)
zero_zero = 0
zero = 0
inf = 0

for _ in range(n):
    a, b = list(map(int, input().split()))
    if a == 0 and b == 0:
        zero_zero += 1

    elif a == 0:
        zero += 1

    elif b == 0:
        inf += 1

    else:
        div = gcd(a, b)
        a //= div
        b //= div
        if b < 0:
            a *= -1
            b *= -1
        key = (a, b)
        fishes[key] += 1


def get_bad_pair(fish):
    a, b = fish
    if a < 0:
        a *= -1
        b *= -1
    return (-b, a)


ans = 1
counted_key = set()
for fish_key, count in list(fishes.items()):
    if fish_key in counted_key:
        continue

    bad_pair = get_bad_pair(fish_key)
    if bad_pair in fishes:
        pair_count = fishes[bad_pair]
        pattern = pow(2, count, mod) + pow(2, pair_count, mod) - 1
        counted_key.add(bad_pair)

    else:
        pattern = pow(2, count, mod)

    ans = ans * pattern % mod

ans *= pow(2, zero, mod) + pow(2, inf, mod) - 1
if zero_zero:
    ans += zero_zero

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


# Optimized solution
def main():
    from collections import defaultdict
    from math import gcd
    import sys
    input = sys.stdin.readline


    mod = 10 ** 9 + 7
    n = int(eval(input()))
    fishes = defaultdict(int)
    zero_zero = 0
    zero = 0
    inf = 0

    for _ in range(n):
        a, b = list(map(int, input().split()))
        if a == 0 and b == 0:
            zero_zero += 1

        elif a == 0:
            zero += 1

        elif b == 0:
            inf += 1

        else:
            div = gcd(a, b)
            a //= div
            b //= div
            if b < 0:
                a *= -1
                b *= -1
            key = (a, b)
            fishes[key] += 1


    def get_bad_pair(fish):
        a, b = fish
        if a < 0:
            a *= -1
            b *= -1
        return (-b, a)


    ans = 1
    counted_key = set()
    for fish_key, count in list(fishes.items()):
        if fish_key in counted_key:
            continue

        bad_pair = get_bad_pair(fish_key)
        if bad_pair in fishes:
            pair_count = fishes[bad_pair]
            pattern = pow(2, count, mod) + pow(2, pair_count, mod) - 1
            counted_key.add(bad_pair)

        else:
            pattern = pow(2, count, mod)

        ans = ans * pattern % mod

    ans *= pow(2, zero, mod) + pow(2, inf, mod) - 1
    if zero_zero:
        ans += zero_zero

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

if __name__ == "__main__":
    main()
# Original solution
#!/usr/bin/python3

from fractions import Fraction

M = 1000000007

def normalize(v):
    if v > 0:
        return v
    else:
        return - 1 / v

n = int(eval(input()))

vs = {}
zc = 0
azc = 0
bzc = 0

for i in range(n):
    (a, b) = list(map(int, input().split()))
    if a == 0 and b == 0:
        zc += 1
        continue

    if a == 0:
        azc += 1
        continue

    if b == 0:
        bzc += 1
        continue

    v = Fraction(a, b)
    if v in vs:
        vs[v] += 1
    else:
        vs[v] = 1

wp = set()
for v in vs:
    if - 1 / v in vs:
        wp.add(normalize(v))

#print(zc, azc, bzc, vs, wp)
        
c = 1
if azc == 0 or bzc == 0:
    c = c * pow(2, azc + bzc, M) % M
else:
    c = c * (pow(2, azc, M) - 1 + pow(2, bzc, M) - 1 + 1) % M

r = n - azc - bzc
for p in wp:
    invp = -1 / p
    c = c * (pow(2, vs[p], M) - 1 + pow(2, vs[invp], M) - 1 + 1) % M
    r -= vs[p] + vs[invp]

r -= zc
c = c * pow(2, r, M) % M
c = (c + zc) % M
c = (c - 1) % M

print(c)





    


# Optimized solution
#!/usr/bin/python3

import math

M = 1000000007

def normalize(v):
    (a, b) = v
    if a * b > 0:
        return (a, b)
    else:
        if a > 0:
            return (-b, a)
        else:
            return (b, -a)
    
def inv(v):
    (a, b) = v
    if a > 0:
        return (-b, a)
    else:
        return (b, -a)
    
    
n = int(eval(input()))

vs = {}
zc = 0
azc = 0
bzc = 0

for i in range(n):
    (a, b) = list(map(int, input().split()))
    if b < 0:
        a = -a
        b = -b

    g = math.gcd(a, b)
        
    if a == 0 and b == 0:
        zc += 1
        continue

    if a == 0:
        azc += 1
        continue

    if b == 0:
        bzc += 1
        continue

    (a, b) = (a // g, b // g)
    if (a, b) in vs:
        vs[(a, b)] += 1
    else:
        vs[(a, b)] = 1

wp = set()
for v in vs:
    if inv(v) in vs:
        wp.add(normalize(v))

#print(zc, azc, bzc, vs, wp)
        
c = 1
if azc == 0 or bzc == 0:
    c = c * pow(2, azc + bzc, M) % M
else:
    c = c * (pow(2, azc, M) - 1 + pow(2, bzc, M) - 1 + 1) % M

r = n - azc - bzc
for p in wp:
    invp = inv(p)
    c = c * (pow(2, vs[p], M) - 1 + pow(2, vs[invp], M) - 1 + 1) % M
    r -= vs[p] + vs[invp]

r -= zc
c = c * pow(2, r, M) % M
c = (c + zc) % M
c = (c - 1) % M

print(c)
# Original solution
from collections import defaultdict
from fractions import Fraction
import sys
input = sys.stdin.readline
N=int(eval(input()))
mod=10**9+7
dic=defaultdict(lambda: [0,0])
c=0
d=0
e=0
for i in [0]*N:
 A,B = list(map(int,input().split()))
 if A==0 and B==0:
  e+=1
 elif A==0:
  c+=1
 elif B==0:
  d+=1
 else:
  if Fraction(A,B)>0:
   dic[Fraction(A,B)][0]+=1
  else:
   dic[Fraction(-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))

# Optimized solution
from collections import defaultdict
from math import gcd
import sys
input = sys.stdin.readline
N=int(eval(input()))
mod=10**9+7
dic=defaultdict(lambda: [0,0])
c=0
d=0
e=0
for i in [0]*N:
 A,B = list(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))