#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;
}

template <typename T>
pair<T ,T> norm(pair<T , T>& p)
{
    if(p.first == 0 && p.second == 0)
        return p;
    else if(p.first == 0)
        p.second = 1;
    else if(p.second == 0)
        p.first = 1;
    else 
        {
            bool sign = (p.first > 0 && p.second < 0 ) || (p.first < 0 && p.second > 0);
            p.first = abs(p.first) , p.second = abs(p.second);
            T g = __gcd(p.first , p.second);
            p.first/=g , p.second /= g;
            if(sign)
                p.first = -p.first;
        }
    return p;
}
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);
        ll zz = 0;
        for(int i = 0; i< n ; i++)
        {
            cin>>a[i].first>>a[i].second;
            a[i] = norm(a[i]);
            if(a[i].first == 0 && a[i].second == 0)
                {
                    zz++;
                    continue;
                }
            m2[a[i]]++;
            if(a[i].first < 0) 
                m[{a[i].second , -a[i].first}]++;
            else 
                m[{-a[i].second , a[i].first}]++;
        }
        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;
            }
        }
        
        ans = (ans*binpow(2 , n - cnt))%mod;
        ans = (ans + zz)%mod;
        cout<<(ans + (mod - 1)%mod)%mod<<"\n";

        
    }
    
    

    

}


Measured memory_bytes: 43828