from decimal import Decimal
import sys
sys.setrecursionlimit(10**9)

mod = 1000000007
def main():
    N = int(input())

    dic = {}
    seen = set()
    def save_count(x):
        if not x in seen:
            dic[x] = 1
            seen.add(x)
        else:
            dic[x] += 1


    for _ in range(N):
        A,B = map(int,input().split())
        tan = Decimal(B) / Decimal(A)
        save_count(tan)

        if tan != Decimal("0"):
            tan_inv = Decimal("-1") / tan
            save_count(tan_inv)

    ans = 0
    p_sum = 0
    for key,val in dic.items():
        p = 0
        if val > 1:
            p = pow(3,val,mod)*pow(2,N-val,mod) - (pow(2,N,mod)+(val)*pow(2,N-1,mod))
        if key != 0:
            p //= 2
        # print(p)

        ans += p%mod


    # print(dic,ans)
    mod_sum = pow(2,N,mod) - 1
    # print(mod_sum,ans)
    ans = (mod_sum - ans) % mod
    print(ans)

if __name__ == "__main__":
  main()