/*COMPETITIVE PROGRAMMING C++ TEMPLATE */

#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <string>
#include <cmath>
#include <iostream>
#include <stack>
#include <queue>
#include <climits>
#include <iomanip>

#define all(x) x.begin(), x.end()
#define MOD 1000000007

const long double PI = 3.141592653589793236L;

typedef long long int ll;
typedef long double ld;

using namespace std;

ll gcd(ll a, ll b)
{
    if(b == 0)
    {
        return a;
    }
    return gcd(b, a % b);
}

ll power(ll x, ll n)
{
    ll res = 1;
    while(n > 0)
    {
        if(n & 1)
        {
            res *= x;
            res %= MOD;
        }
        
        x *= x;
        x %= MOD;

        n = n >> 1;
    }

    return res;
}

void solve()
{
    int N;
    cin >> N;

    vector<pair<ll, ll>> A(N);
    map<pair<ll, ll>, int> mp;
    set<pair<ll, ll>> S;
    int zero_count = 0;

    for(int i = 0; i < N; i++)
    {
        ll a, b;
        cin >> a >> b;

        ll GCD = 1;
        if(a != 0 && b != 0)
            GCD = gcd(abs(a), abs(b));

        A[i].first = a / GCD;
        A[i].second = b / GCD;

        if(A[i].second < 0)
        {
            A[i].first *= -1;
            A[i].second *= -1;
        }
        if(A[i].first == 0 && A[i].second == 0)
        {
            zero_count++;
        }
        else if(A[i].second == 0)
        {
            A[i].first = 1;
        }
        else if(A[i].first == 0)
        {
            A[i].second = 1;
        }
        S.insert(A[i]);

        mp[A[i]]++;
    }
    
    ll ans = 1;
    vector<pair<ll, ll>> B;

    for(auto x : S)
    {
        B.push_back(x);
    }
    
    int M = B.size();
    set<pair<ll, ll>> S1;
    for(int i = 0; i < M; i++)
    {
        pair<ll, ll> bad = {(-1) * B[i].second, B[i].first};

        if(B[i].first == 0 && B[i].second == 0)
        {
            continue;
        }

        if(bad.second < 0)
        {
            bad.first *= -1;
            bad.second *= -1;
        }

        if(B[i].first == 0)
        {
            bad.first = 1;
            bad.second = 0;
        }
        else if(B[i].second == 0)
        {
            bad.first = 0;
            bad.second = 1;
        }

        if(S1.find(B[i]) != S1.end() && S1.find(bad) != S1.end())
        {
            continue;
        }

        ll n = mp[B[i]];
        ll m = mp[bad];

        ll x = 0;
        x += power(2, n);
        x %= MOD;

        x += power(2, m);
        x %= MOD;

        x--;

        ans *= x;
        ans %= MOD;

        S1.insert(B[i]);
        S1.insert(bad);
        
    }
    ans -= 1;
    asn %= MOD;
    ans += MOD;
    ans %= MOD;
    ans += zero_count;
    ans %= MOD;
    cout << ans << endl;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int T = 1;
    //cin >> T;
    
    while (T--)
    {
        solve();
    }
    
    return 0;
}
