mod = 1000000007
N = int(input())
p_p = []
p_m = []
m_p = []
m_m = []
z_z = []
z_p = []
z_m = []
p_z = []
m_z = []
if N == 1:
    print(1)

else:
    for _ in range(N):
        tmp = list(map(int, input().split()))
        if tmp[0] > 0:
            if tmp[1] > 0:
                p_p.append(tmp)
            elif tmp[0] == 0:
                p_z.append(tmp)
            else:
                p_m.append(tmp)
        if tmp[0] == 0:
            if tmp[1] > 0:
                z_p.append(tmp)
            elif tmp[0] == 0:
                z_z.append(tmp)
            else:
                z_m.append(tmp)
        if tmp[0] < 0:
            if tmp[1] > 0:
                m_p.append(tmp)
            elif tmp[0] == 0:
                m_z.append(tmp)
            else:
                m_m.append(tmp)

    counter = 0
    counter += len(z_z) * (N - len(z_z))
    counter = counter % mod
    counter += (len(z_p) + len(z_m)) * (len(p_z) + len(m_z))
    counter = counter % mod
    for a in p_p:
        for b in (p_m + m_p):
            if a[0]*b[0] + a[1] * b[1] == 0:
                counter += 1
    counter = counter % mod
    for a in m_m:
        for b in (p_m + m_p):
            if a[0]*b[0] + a[1] * b[1] == 0:
                counter += 1

    counter = counter % mod
    all_num = (2**N-1) % mod
    answer =(all_num - counter* (2 ** (N-2))) % mod

    print(answer)