#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    const ll mod=1000000007;
    int n;
    cin >> n;
    map<array<ll,2>,vector<int>> m;
    vector<array<ll,2>> v(n+1,{0,0});
    vector<ll> p(n+1,1);
    for(int i=1;i<=n;i++) p[i]=(2*p[i-1])%mod;
    ll one=0,two=0;
    vector<bool> vis(n+1,0);
    for(int i=1;i<=n;i++)
    {
        ll a,b;
        cin >> a >> b;
        ll g=gcd(a,b);
        if(g>0)
        {
            a/=g;
            b/=g;
        }
        if(a==0&&b!=0) one++;
        else if(a!=0&&b==0) two++;
        else if(a!=0&&b!=0) m[{a,b}].push_back(i);
        if(a==0||b==0) vis[i]=1;
        v[i]={a,b};
    }
    ll res=(p[one]+p[two]-1+mod)%mod;
    auto rm=[&](ll a,ll b)->ll
    {
        for(int x:m[{a,b}]) vis[x]=1;
        return m[{a,b}].size();
    };
    for(int i=1;i<=n;i++)
    {
        if(vis[i]==1) continue;
        auto [a,b]=v[i];
        one=rm(a,b)+rm(-a,-b);
        two=rm(-b,a)+rm(b,-a);
        res=(res*(p[one]+p[two]-1+mod))%mod;
    }
    res=(res-1+mod)%mod;
    cout << res << "\n";
    return 0;
}
