import bisect
import heapq
import itertools
import math
from collections import Counter, defaultdict, deque
from copy import deepcopy
from decimal import Decimal
from math import gcd
from operator import add, itemgetter, mul, xor
def cmb(n,r,mod):
  bunshi=1
  bunbo=1
  for i in range(r):
    bunbo = bunbo*(i+1)%mod
    bunshi = bunshi*(n-i)%mod
  return (bunshi*pow(bunbo,mod-2,mod))%mod
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
def I(): return int(input())
def LI(): return list(map(int,input().split()))
def MI(): return map(int,input().split())
def LLI(n): return [list(map(int, input().split())) for _ in range(n)]

n = I()
ab = LLI(n)

s = [[] for _ in range(n)]
for i in range(n):
  for j in range(i+1, n):
    if ab[i][0] * ab[j][0] == - ab[i][1] * ab[j][1]:
      # s[i].append(j)
      s[j].append(i)
left = [1] * n
for i in range(n):
  for j in s[i]:
    left[i] += left[j]
    left[j] += left[j]
    left[j] %= mod
  left[i] %= mod
print(left)
ans = 2 ** n - sum(left) - 1

print((ans)%mod)
