import collections
import decimal
decimal.getcontext().prec = 6

def pow_k(x, n):
    """
    O(log n)
    """
    MOD = 10 ** 9 + 7
    if n == 0:
        return 1

    K = 1
    while n > 1:
        if n % 2 != 0:
            K *= x
            K %= MOD
        x *= x
        x %= MOD
        n //= 2

    return K * x

n = int(input())

ab = []
l = [] #  b / aを格納
for _ in range(n):
	tmp = list(map(int,input().split()))
	ab.append(tmp)
	l.append(decimal.Decimal(tmp[1]) / decimal.Decimal(tmp[0]))

#print(l)

count = collections.Counter(l)

#print(count)
ans = 0
tmp = n
for i in range(n):
	num = decimal.Decimal(-1) / decimal.Decimal(l[i])
	if num in count:
		N = tmp - count[num] - 1
	else:
		N = tmp - 1
	ans += pow_k(2,N)
	ans %= 1000000007
	#print(N,num,ans)
	count[decimal.Decimal(l[i])] -= 1
	tmp -= 1
	#print(count)

print(ans)
