#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 x,y;
    cin>>x>>y;
    if(x==0&&y==0){
        zero++;
        continue;
    }
    ll g = gcd(x,y);
    x/=g;
    y/=g;
    if(y<0){
        x=-x,y=-y;
    }
    if(y==0&&x<0){
        x=-x;
        y=-y;
    }
    bool rot90=(x<=0);
    if(rot90){
        ll tmp=x;
        x=y,y=-tmp;
    }
    if(rot90)mp[{x,y}].first++;
    else mp[{x,y}].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%=MOD;
    now+=modpow(2,t,MOD)-1;
    now%=MOD;

    ans= (ans*now)%MOD;
}
ans-=1;
ans+=zero;
ans%=MOD;
cout<<ans<<endl;
return 0;
}