MOD = 1000000007

def solve(N, ABs):
    groups = {}
    for a, b in ABs:
        k = a / b
        groups.setdefault(k, 0)
        groups[k] += 1

    visited = set()
    possibles = []
    for k, v in groups.items():
        if k in visited:
            continue
        p = 0
        p += pow(2, v, MOD)
        m = - (1.0 / k)
        if m in groups.keys():
            p += pow(2, groups[m], MOD)
            visited.add(m)
            p -= 1
        possibles.append(p % MOD)

    ans = 1
    for p in possibles:
        ans *= p
        ans %= MOD
    return ans - 1


if __name__ == "__main__":
    N = int(input())
    ABs = [tuple(map(int, input().split(" "))) for _ in range(N)]
    print(solve(N, ABs))
