#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define pb push_back
#define fi first
#define se second
const ll inf = 1e18;
const ld pi = acos(-1.0);
const int N = 3e5+6;
const int M = 1e9+7;
map<pair<ll,ll>,int>mp;
ll po(ll a,ll b){
    if(b==0)return 1;
    ll x = po(a,b/2);
    x = (x*x)%M;
    if(b&1)x = (x*a)%M;
    return x;
}
void solve(){
    int n;
    cin>>n;
    int cnt = 0;
    for(int i=0;i<n;i++){
        ll x,y;
        cin>>x>>y;
    //    px[i] = x;
     //   py[i] = y;
        ll g = __gcd(x,y);
        x = x/g;
        y = y/g;
        mp[{x,y}]++;
    }
    ll ans = 1;
    for(auto p:mp){
        ll c = p.second;
        ll x = p.first.first;
        ll y = p.first.second;
        if(c==0)continue;
ll xx = y;
        ll yy = -x;
        ll g = __gcd(xx,yy);
        xx/=g;
        yy/=g;
        ll pp = mp[{xx,yy}];
        mp[{xx,yy}]=0;

        ll A = po(2,c)-1;
        ll B = po(2,pp)-1;
        ans*= (A+B+1);
        ans%=M;
    }
    cout<<ans-1<<endl;
}
int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int t=1;
 //   cin>>t;
    while(t--)solve();
    return 0;
}
