#include <bits/stdc++.h>

#define int         long long
#define uint        unsigned int
#define ld          long double
#define showoff     ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb          push_back
#define pii         pair<int,int>
#define FOR(i,a,b)  for(int i=a;i<b;++i)
#define RFOR(i,a,b) for(int i=a;i>b;--i)
#define f           first
#define se          second
#define maxn        200005
#define all(v)      v.begin(),v.end()
#define sz(x)       (int)x.size()
#define mod         1000000007
#define pqueue      priority_queue<int>
#define pdqueue     priority_queue< int,vector<int> ,greater< int >>
#define PI 3.14159265359
 
using namespace std;
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
 
int power(int a,int n)
{
    a %= mod;
    if(n == 1)return a;
    if(n == 0)return 1;
    if(n%2)return (a*(power((a*a)%mod,n/2)%mod))%mod;
    return power((a*a)%mod,n/2)%mod;
}
const int inf = (int) 1e18;
 
int inverse(int x){
    return power(x,mod-2)%mod;//little fermat....
}
void solve(){
    int n;
    cin >> n;
    vector<int>a(n+5),b(n+5);
    FOR(i,1,n+1)cin >> a[i] >> b[i];
    map<pii,int>mp1,mp2,taken;
    FOR(i,1,n+1){
        int g = __gcd(abs(a[i]),abs(b[i]));
        a[i] /= g;
        b[i] /= g;
        if(b[i] < 0)a[i] = -a[i],b[i] = -b[i];
        mp1[{a[i],b[i]}]++;
        if(a[i] < 0)a[i] = -a[i],b[i] = -b[i];
        mp2[{-b[i],a[i]}]++;
    }
    int ans = 1;
    for(auto &x:mp1){
        if(taken[x.f])continue;
        //cout << x.f.f << " " << x.f.se << " ";
        taken[{x.f.se,-x.f.f}] = 1;
        int tmp = power(2,x.se)+power(2,mp2[x.f]);
        tmp %= mod;
        tmp = (tmp-1+mod)%mod;
        //cout << tmp << "\n";
        ans *= tmp;
        ans %= mod;
    }
    cout << ((ans-1+mod)%mod) << "\n";
}   

signed main()
{
    showoff;
    int T;
    //cin >> T;
    T = 1;
    FOR(t,1,T+1){
        solve();
    }
    
    return 0;
}
//*->for large size of matrix take int not long long if possible......
//*->always take maximum as inf for safer side ... 