#include <bits/stdc++.h>
using namespace std;

typedef std::pair<long long, long long> pair;

struct comp
{
    template <typename T>
    bool operator()(const T &l, const T &r) const
    {
        if (l.first == r.first)
            return l.second > r.second;

        return l.first < r.first;
    }
};

long long modpow(long long a, long long n, long long mod)
{
    long long res = 1;
    while (n > 0)
    {
        if (n & 1)
            res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

int main()
{
    long long p = 1000000007;
    int N;
    cin >> N;
    long long A[N], B[N];
    map<pair, long long, comp> mp;
    for (int i = 0; i < N; i++)
    {
        cin >> A[i] >> B[i];
        long long kou = __gcd(A[i], B[i]);
        long long a = A[i] / kou;
        long long b = B[i] / kou;
        if (b < 0)
        {
            a = -a;
            b = -b;
        }
        pair pr = make_pair(a, b);
        mp[pr]++;
    }
    long long ans = 0;
    for (int i = 0; i < N; i++)
    {
        long long kou = __gcd(A[i], B[i]);
        long long a = A[i] / kou;
        long long b = B[i] / kou;
        if (b < 0)
        {
            a = -a;
            b = -b;
        }
        ans += modpow(2, N - mp[make_pair(-a, b)], p) - 1;
        ans %= p;
    }
    cout << ans << endl;
}