#include <bits/stdc++.h>
using namespace std;
const auto start_time = std::chrono::high_resolution_clock::now();
void timecalculater(){
    #ifndef ONLINE_JUDGE
    auto end_time = std::chrono::high_resolution_clock::now();
    std::chrono::duration<double> diff = end_time-start_time;
    cerr<<"Time Taken : "<<diff.count()<<"\n";
    #endif
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
void __print(int x) {cout << x;}
void __print(long x) {cout << x;}
void __print(long long x) {cout << x;}
void __print(unsigned x) {cout << x;}
void __print(unsigned long x) {cout << x;}
void __print(unsigned long long x) {cout << x;}
void __print(float x) {cout << x;}
void __print(double x) {cout << x;}
void __print(long double x) {cout << x;}
void __print(char x) {cout << '\'' << x << '\'';}
void __print(const char *x) {cout << '\"' << x << '\"';}
void __print(const string &x) {cout << '\"' << x << '\"';}
void __print(bool x) {cout << (x ? "true" : "false");}
template<typename T, typename V>
void __print(const pair<T, V> &x) {cout << '{'; __print(x.first); cout << ','; __print(x.second); cout << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cout << '{'; for (auto &i: x) cout << (f++ ? "," : ""), __print(i); cout << "}";}
void _print() {cout << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cout << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define dbg(x...) cout << "[" << #x << "] = ["; _print(x)
#else
#define dbg(x...)
#endif
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define repA(i, a, n) for(int  i = a; i <= (n); ++i)
#define all(x) x.begin(), x.end()
#define sz(x) (int) (x).size()
#define fill(a,v) memset(a, v, sizeof(a))
#define fst first
#define snd second
#define mp make_pair
#define pb push_back
#define endl '\n'
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long long int> vll;
typedef vector<pii> vii;
ll p=1e9+7;
const int N=2e5+5;
ll add(ll a,ll b){
    ll t=(a+b);
    if(t>=p)t%=p;
        return t;
}
ll sub(ll a,ll b){
    ll t=a-b+p;
    t=t%p;
    return t;
}
ll power(ll a,ll x){
    ll r=1;
    while(x!=0){
        if(x%2==1){
            r=r*a;r%=p;
        }
        a=a*a;a%=p;
        x=x/2;
    }
    return r;
}
ll mul(ll a,ll b){
    ll t=(a*b);
    if(t>=p)t%=p;
    return t;
}
ll divide(ll a, ll b){
    return mul(a,power(b,p-2));
}
int main() {
   
    cin.sync_with_stdio(0); cin.tie(0);
    cin.exceptions(cin.failbit);
    int T=1;
    // cin>>T;
    while(T--){
        ll n;cin>>n;
        ll a[n],b[n];
        rep(i,n)cin>>a[i]>>b[i];
        map<pair<ll,ll>,ll> m;
        ll f=0,s=0;ll ans=0;
        ll r=0;
        rep(i,n){
            if(a[i]==0&&b[i]==0){
                r++;
                continue;
            }
            if(a[i]==0){f++;continue;}
            if(b[i]==0){s++;continue;}
            if(a[i]<0&&b[i]<0){
                a[i]=-a[i];b[i]=-b[i];
            }
            else if(b[i]<0){
                a[i]=-a[i];b[i]=-b[i];
            }
            ll g=__gcd(abs(a[i]),abs(b[i]));
            a[i]=a[i]/g;b[i]=b[i]/g;
            m[{a[i],b[i]}]++;
            // dbg(a[i],b[i]);
        }
        ans=sub(add(power(2,f),power(2,s)),1);
        vector<pair<ll,ll> >v;
        map<pair<ll,ll>, ll > visit;
        for(auto j:m){
            ll x=j.fst.fst,y=j.fst.snd;
            if(visit.find({x,y})!=visit.end())continue;
            ll xx=x;ll yy=y;
            if(x>0&&y>0){
                yy=-y;
            }
            else if(x<0){
                xx=-x;
            }
            visit[{yy,xx}]=1;
            ll c=j.snd;
            // dbg(c);
            if(m.find({yy,xx})!=m.end()){
                ans=mul(ans,sub(add(power(2,c),power(2,m[{yy,xx}])),1));
            } 
            else{
                ans=mul(ans,power(2,c));
            }
        }
        ans=sub(ans,1);
        ans=add(ans,r);
        cout<<ans;
    }   
    timecalculater();
    return 0;   
} 

Measured memory_bytes: 31640