#include <bits/stdc++.h>
using namespace std;
#define endl "\n";
#define int long long
#define fastio ios_base::sync_with_stdio(0); cin.tie(0)
#define double long double
#define M_PI 3.14159265358979323846 
const int mod = 1e9 + 7;

int power(int x, int y, int p)  
{  
    int res = 1;     // Initialize result  
  
    x = x % p; // Update x if it is more than or  
                // equal to p 
   
    if (x == 0) return 0; // In case x is divisible by p; 
  
    while (y > 0)  
    {  
        // If y is odd, multiply x with result  
        if (y & 1)  
            res = (res*x) % p;  
  
        // y must be even now  
        y = y>>1; // y = y/2  
        x = (x*x) % p;  
    }  
    return res;  
}  

int32_t main()
{
    fastio;

    int n; cin >> n;
    map<pair<int,int>, vector<int>> mp;
    vector<pair<int,int>> v(n);
    vector<vector<int>> a(n);
    for(int i=0; i<n; i++){
        int x, y; cin >> x >> y;
        int g = __gcd(x,y);
        x /= g;
        y /= g;
        v[i] = {x,y};
        mp[{x,y}].push_back(i);
    }

    for(int i=0; i<n; i++){
        for(auto e:mp[{v[i].second, -v[i].first}]){
            a[i].push_back(e);
        }
        for(auto e:mp[{-v[i].second, v[i].first}]){
            a[i].push_back(e);
        }
    }
    
    int ans = power(2LL,n,mod)-1;
    vector<bool> visited(n,false);
    for(int i=0; i<n; i++) if(!visited[i] && a[i].size()>0){
        int cnt = 0;
        // visited[i]
        for(auto e: a[i]){
            visited[e] = true;
            cnt++;
        }
        // for(auto e: visited) cout << e << " ";
        // cout << endl;
        ans = (ans-power(2LL,cnt,mod)+mod)%mod;
        //cout << i << " " << cnt << " " << ans << endl;
    }

    cout << ans << endl;
    return 0;
}

/*
3 1 2 4
1 2 3
*/