#include <bits/stdc++.h>

#define pb push_back
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n,s) for(int i=(s);i<(n);i++)
#define rrep(i,n) for(int i=(n-1);i>=0;i--)
#define rreps(i,n,s) for(int i=s;i>=n;i--)
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

using ll = long long;

using namespace std;
constexpr long long MAX = 5100000;
constexpr long long INF = 1LL << 60;
constexpr int MOD = 1000000007;
constexpr double PI = acos(-1);

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

ll modpow(ll a, ll n, ll mod)
{
    ll res = 1;
    while (n)
    {
        if (n & 1)
        {
            res = (res * a) % mod;
        }
        a = (a * a) % mod;
        n /= 2;
    }
    return res;
}

int main(){
cin.tie(0);
ios::sync_with_stdio(false);
int n;
cin>>n;
ll zero=0;
map<pair<ll,ll>,pair<int,int>> mp;
rep(i,n){
    ll a,b;
    cin>>a>>b;
    if(a==0&&b==0){
        zero++;
        zero%=MOD;
        continue;
    }
    ll g = gcd(a,b);
    a/=g;
    b/=g;
    if(b<0){
        a=-a,b=-b;
    }
    if(b==0&&a<0){
        a=-a;
    }
    bool rot90=(a<=0);
    if(rot90){
        ll tmp=a;
        a=b,b=-tmp;
    }
    if(rot90){mp[{a,b}].first++;}
    else{mp[{a,b}].second++;}
}

ll ans=1;

for(auto v: mp){
    int s=v.second.first;
    int t=v.second.second;
    ll now=1;
    now+=modpow(2,s,MOD)-1;
    now+=modpow(2,t,MOD)-1;
    ans*=now;
    ans%=MOD;
}
ans-=1;
ans+=zero;
cout<<ans<<endl;
return 0;
}