#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
 
using namespace __gnu_pbds;
using namespace std;
 
typedef long long int ll;
typedef unsigned long long int sll;
typedef  double ld;
#define A 1000000007ll
#define D 1000000000ll
#define B 998244353ll
#define C 1000000000000000000ll
#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define oset tree<pair<ll,ll>, null_type,less<pair<ll,ll>>, rb_tree_tag,tree_order_statistics_node_update> 
#define pb push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define mxe(v) *max_element(v.begin(),v.end())
#define mne(v) *min_element(v.begin(),v.end())
#define bs binary_search
#define lb lower_bound
#define ub upper_bound
#define ve vector
#define br break
#define PI 3.14159265358979323
#define subt cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n"

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

ll power(ll x, ll y, ll p) 
{ 
    ll res = 1;
    x = x % p; 
    while (y > 0) 
    { 
        if (y & 1) 
            res = (res*x) % p; 
        y = y>>1; 
        x = (x*x) % p; 
    } 
    return res; 
} 

int main() 
{
    FAST;
    ll n;
    cin>>n;
    ll a,b;
    map<pair<ll,ll>,ll> m;
    set<pair<ll,ll>> s;
    ll y=0;
    for(int i=0;i<n;i++)
    {
        cin>>a>>b;
        if(a==0 && b==0)
        {
            y++;
            continue;
        }
        if(a!=0 && b==0)
            a=1;
        if(a==0 && b!=0)
            b=1;
        if(a!=0 && b!=0)
        {
            ll x=gcd(a,b);
            a=a/x;
            b=b/x;
            if(b<0)
            {
                a=-1*a;
                b=-1*b;
            }
        }
        m[{a,b}]++;
        s.insert({a,b});
    }
    ll ans=1;
    while(s.size()!=0)
    {
        auto i=s.begin();
        pair<ll,ll> p=(*i),q=p;
        q.first=(-1)*p.second;
        q.second=p.first;
        if(q.second<0)
        {
            q.first*=-1;
            q.second*=-1;
        }
        ans=(ans*(power(2,m[p],A)+power(2,m[q],A)-1))%A;
        s.erase(p);
        s.erase(q);
    }
    ans=(ans+y-1)%A;
    ans=ans+A;
    ans%=A;
    cout<<ans;
    subt;
    return 0;
}