#include <bits/stdc++.h>

using namespace std;

typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vii;
typedef vector<ll> vll;
typedef pair<int,int> pii;

#define FASTIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb push_back
#define odd(x) ((x)&1)
#define even(x) (!odd(x))
#define ff it->first
#define ss it->second
#define all(v) (v).begin(),(v).end()
#define rep(i,n) for(auto i=0;i<n;++i)
#define LOOP_IT(it,s) for(auto it=(s).begin();it!=(s).end();++it)


#ifdef LOCAL
#define cerr cout
#else
#endif

#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif


void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}


template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif




ll const mod=1e9+7;

ll mod_pow(ll a, ll n) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = (a * a) % mod;
        n >>= 1;
    }
    return res;
}

pair<ll,ll> mk_hash(ll x,ll y)
{
    bool f1=0,f2=0;
    if(x<0ll)
        f1=1;
    if(y<0ll)
        f2=1;
    x = abs(x),y = abs(y);
    ll n = __gcd(x,y);
    pair<ll,ll> p;



    if(x==0ll)
        p = {0ll,1ll};
    else if(y==0ll)
        p = {1ll,0ll};
    else
        p = {x/n,y/n};


    if(f1^f2)
        p.first = -p.first;
    return p;
}


int main(int argv, char* argc[])
{
    FASTIO

    ll n,tot,ans=0ll;
    cin>>n;
    vector<pair<ll,ll>> v(n);
    map<pair<ll,ll>,ll> mp;
    ll len=n;
    rep(i,n)
    {
        ll x,y;
        cin>>x>>y;
        v[i]={x,y};
        if(x==0&&y==0)
            {--len,--n;continue;}
        ++mp[mk_hash(x,y)];
    }

    //__print(mp);
    pair<ll,ll> p;
    ll cf = 1;

    LOOP_IT(it,mp)
    {
        if(ff==make_pair(0ll,1ll))
            p = {1ll,0ll};
        else if(ff==make_pair(1ll,0ll))
            p = {0ll,1ll};
        else
            p = mk_hash(-ff.second,ff.first);
        if(ss==0ll||mp[p]==0ll)
            continue;

        tot = ((mod_pow(2,mp[p])-1)*(mod_pow(2,ss)-1));tot%=mod;

        len-=(ss+mp[p]);
        tot*=(mod_pow(2,len)*cf)%mod;tot%=mod;

        cf*=(mod_pow(2,ss)+mod_pow(2,mp[p])-1);cf%=mod;

        mp[ff] = 0ll;
        mp[p] = 0ll;
        ans+=tot;ans%=mod;
    }

    ll whole = mod_pow(2,n)-1;
    if(whole<ans)
        whole+=mod;
    ans = whole - ans;
    cout<<ans;




    return 0;
}
