#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
 
using namespace std;
using namespace __gnu_pbds;
 
 
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define f first
#define s second
#define resz resize
#define ini ll_MAX
#define inl LLONG_MAX
#define MOD 1000000007
#define sz(x) ll((x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define F0R(i, a) for (ll i = 0; i < (a); i++)
#define FORR(i, a, b) for (ll i = a; i >= (b); i--)
#define F0RR(i, a) for (ll i = a; i >= 0; i--)
#define trav(a, x) for (auto& a : x)
#define pbds tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
 
using ll = long long;
using vi = vector<ll>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vd = vector<double>;
using vs = vector<string>;
 
using pii = pair<ll, ll>;
using pll = pair<ll, ll>;
using pdd = pair<double, double>;
 
using vpii = vector<pii>;
using vvpii = vector<vpii>;
using vpll = vector<pll>;
using vvpll = vector<vpll>;
using vpdd = vector<pdd>;
using vvpdd = vector<vpdd>;
 
ll mod(ll a,ll b)
{
    return (b+a%b)%b;
}
 
ll gcd(ll a,ll b)
{
    if(b==0)return a;
    else return gcd(b,a%b);
}
ll po(ll a,ll b)
{
    ll ans = 1;
    while(b--)
        ans*=a;
    return ans;
}
ll power(ll a,ll b,ll c)
{
    ll x=1,y=a;
    while(b > 0)
    {
        if(b%2 == 1)
        {
            x=(x*y)%c;
        }
        y = (y*y)%c;
        b /= 2;
    }
    return x%c;
}
 
double sqdist(double a,double b,double c,double d)
{
    return (a-c)*(a-c)+(b-d)*(b-d);
}
ll fact(ll n)
{
    if(n==0)return 1;
    ll ans = 1;
    FOR(i,1,n+1)ans*=i;
    return ans;
}
 
 

void solve()
{
    ll n;cin>>n;
    map<pair<ll,ll>,ll> ma;ll ans = 1,an = 0;

    set<pair<ll,ll>> s;
    for(ll i=0;i<n;i++)
    {
        ll a,b;
        cin>>a>>b;
        if(a==0 && b==0)
            an ++;
        else {
            ll p = abs(a),q = abs(b);
            p/=gcd(abs(a),abs(b));
            q/=gcd(abs(a),abs(b));
            
            // cout<<p<<' '<<q<<endl;
            if(a*b<0){ma[mp(-p,q)]++;s.insert(make_pair(-p,q));}
            else {ma[mp(p,q)]++;s.insert(make_pair(p,q));}
        }
    }
    set<pair<ll,ll>> vis;
    for(auto it = s.begin();it!=s.end();it++)
    {
        if(vis.find(mp(it->first,it->second))==vis.end())
        {
            ll k = ma[mp(it->first,it->second)];
            ll l = ma[mp(it->second,-1*it->first)];
            vis.insert(mp(it->first,it->second));
            vis.insert(mp(it->second,-1*it->first));
            ll v = (power(2,k,MOD) + power(2,l,MOD))%MOD;
            ans = (ans *  ((v-1+MOD)%MOD))%MOD;
        }
    }   
    cout<<((ans-1+MOD)%MOD + an)%MOD<<endl;
}   
main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    solve();
}