#include<bits/stdc++.h>
using namespace std;
//#pragma GCC target("popcnt")  //https://godbolt.org/z/yQv94Y 

typedef long long int ll;
typedef unsigned long long int  ull;
typedef long double ld;

#define INF 1e9
#define pi 3.141592653589
#define e 2.718281828459
#define phi 1.618033988749
#define MOD 1000000007
#define printarr(arr,n){for(int i=0;i<(n);i++){cout<<arr[i]<<" ";}cout<<endl;}
#define foreach(it , l) for(auto it = l.begin(); it != l.end(); ++it)
#define xlr8 ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define pll pair<ll,ll>
#define vpll vector<pair<ll,ll> >
#define rev_sort(a) sort(a.rbegin(),a.rend());

struct Timer
{
    chrono::time_point<chrono::high_resolution_clock> start , end;
    chrono:: duration<float> dur;
    Timer()
    {
        start = chrono::high_resolution_clock::now();
    }
    ~Timer()
    {
        end = chrono::high_resolution_clock::now();
        dur = end - start;
        cout<<"\nTime Elapsed : " <<dur.count() << " s\n";
    }
};

ll sum() {return 0;}
template<typename T, typename... Args>
T sum(T a , Args... args)   {return a + sum(args...); }

//76149
template<int D, typename T> 
struct Vec : public vector<Vec<D - 1, T>> {
  static_assert(D >= 1, "Vector dimension must be greater than zero!");
  template<typename... Args>
  Vec(int n = 0, Args... args) : vector<Vec<D - 1, T>>(n, Vec<D - 1, T>(args...)) {
  }
};
template<typename T>
struct Vec<1, T> : public vector<T> {
  Vec(int n = 0, T val = T()) : vector<T>(n, val) {
  }
};


ll binpow(ll x, ll n,ll mod = MOD )
{
    ll ans =1;
    x = x%mod;
    while(n>=1)
    {
        if(n&1)
            ans=(ans*x)%mod;
        x=(x*x)%mod;
        n>>=1;
    }
    return ans;
}
int main()
{
    xlr8;
    int testCases  = 1;
    //cin>>testCases;
    while (testCases--)
    {
        const ll mod = 1000000007;
        ll n;
        cin>>n;
        map<pair<ll , ll> , ll > m , m2;
        vector<pair<ll , ll> > a(n);
        int xz = 0 , zx = 0 , zz  = 0;
        for(int i = 0; i< n ; i++)
        {
            cin>>a[i].first>>a[i].second;
            if(a[i].first == 0 || a[i].second == 0)
            {
                if(a[i].first == 0 && a[i].second == 0)
                    zz++;
                else if(a[i].first == 0)
                    zx++;
                else 
                    xz++;
                continue;
            }
            
            int sign = ( (a[i].first > 0 && a[i].second < 0) || (a[i].first < 0 && a[i].second > 0) );
            a[i].first = abs(a[i].first) , a[i].second = abs(a[i].second);
            ll g = __gcd(a[i].first , a[i].second);
            a[i].first/=g , a[i].second/=g;

            if(sign) 
                {
                    m[{a[i].second , a[i].first}]++;
                    a[i].first*=-1;
                }
            else 
                {
                    m[{-a[i].second , a[i].first}]++;
                }
            m2[{a[i].first , a[i].second}]++;
        }
        n-=zz;
        ll ans = 1LL;
        ll cnt = 0;
        for(auto p : m2)
        {
            ll x = m[{p.first.first , p.first.second}];
            if(x > 0)
            {
                cnt+= (p.second + x);
                ll tmp = ( (binpow(2LL , p.second ) + binpow(2LL , x))%mod + (mod -1))%mod;
                int sign = ( p.first.first < 0 );
                if(sign)
                    m[{p.first.second , -p.first.first}] = 0;
                else 
                    m[{-p.first.second , p.first.first}] = 0;
                ans = (ans* tmp)%mod;
            }
        }
        if(zx > 0 && xz > 0)
        {
            ll tmp = ( (binpow(2LL , zx ) + binpow(2LL , xz))%mod + (mod -1))%mod;
            ans = (ans*tmp)%mod;
            cnt+= (zx + xz);
        }
      	
        ans = (ans*binpow(2 , n - cnt))%mod;
      	ans = (ans + zz)%mod;
        cout<<(ans + (mod - 1)%mod)%mod<<"\n";

        
    }
    
    

    

}


Measured memory_bytes: 43700