#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0;i<n;i++)
int mod = 1000000007;
#define ll long long

int main() {
    int n;
    cin>>n;
    ll a,b,ans=n;
    vector<ll> s;
    rep(i,n) {
        cin>>a>>b;
        s.push_back(a/b);
        s.push_back(-b/a);
    }
    sort(s.begin(),s.end());
    int flag=0;
    vector<int> dob;
    rep(i,s.size()){
        if(flag ==0 and s[i]==s[i+1]){
            flag=1;
            int cnt=2;
        }else if(s[i]==s[i+1]){
            cnt++;
        }else if(flag) {
            n-=cnt-1;
            flag=0;
        }
    }
    if(flag)n-=cnt-1;
    ll ans1=1;
    rep(i,n){
        ans1*=2;
        ans1%=mod;
    }
    cout << (ans+ans1)%mod <<endl;
}