//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define mii map <int, int>
#define mll map <ll, ll>
#define pii pair <int, int>
#define pll pair <ll, ll>
#define vi vector <int>
#define vd vector <double>
#define vll vector <ll>
#define fi first
#define se second
#define si set <int>
#define sll set <ll>
#define spii set <pii>
#define vs vector <string>
#define vpii vector <pair <int,int> >
#define vpll vector <pair <long long,long long> >
#define vvi vector <vector <int> >
#define vvpii vector <vector <pii > >
#define mp make_pair
#define vvll vector <vll>
#define vsi vector <si>
#define forn(i, n) for (int i = 0; i < (n); i++)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define for1(i, n) for (int i = 1; i < (n); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(),(x).rend()


const ll INFLL = 1e18;
const int MAXN = 4e5+100;
const ll INF = 1e9;
const ll mod1=1e9+7;
const ll mod2=2e9+11;
ll add(ll a,ll b)
{
    a+=b;
    if (a>=mod1)
        return a-mod1;
    return a;
}

ll mult(ll a,ll b)
{
    return (a*b)%mod1;
}

ll sub(ll a,ll b)
{
    a-=b;
    if (a<0)
        return a+mod1;
    return a;
}

ll bin_pow(ll base,ll deg)
{
    if (deg==0)
        return 1;
    ll t=bin_pow(base,deg/2);
    if (deg&1)
        return (((t*t)%mod1)*base)%mod1;
    else
        return (t*t)%mod1;
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#ifdef LOCAL
    freopen("a.in","r",stdin);
#endif
    vector <ll> two(MAXN);
    ll f=1;
    for (int i=0;i<MAXN;i++)
        two[i]=f,f*=2,f%=mod1;
    int n;
    cin>>n;
    map <pll,ll> m;
    map <pll,bool> mm;
    ll cnt=0;
    for (int i=0;i<n;i++)
    {
        ll x,y;
        cin>>x>>y;
     //   cout<<"Was: "<<x<<" "<<y<<'\n';
        if (x==0||y==0)
        {
            if (x==0&&y==0)
                cnt++;
            else
            {
                if (x==0)
                    y=1;
                else
                    x=1;
                m[{x,y}]++;
            }
            continue;
        }
        ll t=__gcd(x,y);
        x/=t,y/=t;
        if (x<0)
            x*=-1,y*=-1;
      //  cout<<x<<' '<<y<<'\n';
        m[{x,y}]++;
    }
    if (cnt==n)
    {
        cout<<n;
        return 0;
    }
    ll ans=1;
    if (m.find({1,0})!=m.end()||m.find({0,1})!=m.end())
    {
        if (m.find({1,0})!=m.end()&&m.find({0,1})!=m.end())
        {
            ans=mult(ans,(two[m[{1,0}]]+two[m[{0,1}]]-1)%mod1);
        }
        else
        {
            if (m.find({1,0})!=m.end())
                ans=mult(ans,two[m[{1,0}]]);
            else
                ans=mult(ans,two[m[{0,1}]]);
        }
    }
    for (auto to:m)
    {
        if (to.fi==mp(1ll,0ll)||to.fi==mp(0ll,1ll))
            continue;
        if (to.fi.se>0&&to.fi.fi>0) {
            if (m.find({to.fi.se, -to.fi.fi}) != m.end()) {
                //  cout<<to.fi.fi<<" "<<to.fi.se<<'\n';
                if (mm[{to.fi.se, -to.fi.fi}] == 0 && mm[{to.fi.fi, to.fi.se}] == 0) {
                    ans = mult(ans, (two[to.se] + two[m[{to.fi.se, -to.fi.fi}]] - 1) % mod1);
                    //   cout<<(two[to.se] + two[m[{to.fi.se, -to.fi.fi}]] )<<'\n';
                    mm[{to.fi.se, -to.fi.fi}] = 1;
                    mm[{to.fi.fi, to.fi.se}] = 1;
                }
            } else {
                if (mm[{to.fi.fi, to.fi.se}] == 0) {
                    ans = mult(ans, two[to.se]);
                    mm[{to.fi.fi, to.fi.se}] = 1;
                }
            }
        }
    }
    for (auto to:m)
    {
        if (to.fi==mp(1ll,0ll)||to.fi==mp(0ll,1ll))
            continue;
            if (m.find({to.fi.se, -to.fi.fi}) != m.end()) {
                //  cout<<to.fi.fi<<" "<<to.fi.se<<'\n';
                if (mm[{to.fi.se, -to.fi.fi}] == 0 && mm[{to.fi.fi, to.fi.se}] == 0) {
                    ans = mult(ans, (two[to.se] + two[m[{to.fi.se, -to.fi.fi}]] - 1) % mod1);
                    //   cout<<(two[to.se] + two[m[{to.fi.se, -to.fi.fi}]] )<<'\n';
                    mm[{to.fi.se, -to.fi.fi}] = 1;
                    mm[{to.fi.fi, to.fi.se}] = 1;
                }
            } else {
                if (mm[{to.fi.fi, to.fi.se}] == 0) {
                    ans = mult(ans, two[to.se]);
                    mm[{to.fi.fi, to.fi.se}] = 1;
                }
            }
    }
    cout<<(ans-1+mod1+cnt)%mod1;




}


Measured memory_bytes: 31356