#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define call(var) cerr<<#var<<"="<<var<<"\n";
#define dup(x,y) (((x)+(y)-1)/(y))
#define all(x) (x).begin(),(x).end()
using ll=long long;
using vi = vector<int>;
using vl = vector<ll>;
using vb = vector<bool>;
using Graph = vector<vi>;
using P = pair<int,int>;
const int MOD=(int)1e9+7;
const int INF=(int)1e9;
const ll LINF=(ll)1e18;
template<class t,class u> inline bool chmax(t&a,u b){if(a<b){a=b;return true;}return false;}
template<class t,class u> inline bool chmin(t&a,u b){if(b<a){a=b;return true;}return false;}

struct mint {
    long long x;
    mint(long long x=0):x((x%MOD+MOD)%MOD){}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += MOD-a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint& operator*=(const mint a) {
        (x *= a.x) %= MOD;
        return *this;
    }
    mint operator+(const mint a) const {
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res*=a;
    }
    mint pow(long long t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    // for prime MOD
    mint inv() const {
        return pow(MOD-2);
    }
    mint& operator/=(const mint a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint a) const {
        mint res(*this);
        return res/=a;
    }
    friend ostream& operator<<(ostream& os, const mint& oj);
};

ostream& operator<<(ostream& os, const mint& oj){
    os << oj.x;
    return os;
}

mint factorial(int n){
    mint res = 1;
for(int i=1;i<=n;++i){
        res *= i;
    }
    return res;
}

mint nCr(int n,int r){
    mint numerator = 1;
    if(r > n - r) r = n - r;
    for(int i=n;i>n-r;--i){
        numerator *= i;
    }
    mint denominator = 1;
    for(int i=1;i<=r;++i){
        denominator *= i;
    }
    return numerator/denominator;
}

int main(){
    int n;cin >> n;

    map<tuple<ll,ll,bool>, int> mp;
    // a[i], b[i], + or -, cnt(used is -1)
    // if a[i] or b[i] == 0 => nonzero = 1
    mint zero = 0;

    rep(i,n){
        ll x,y;cin >> x >> y;
        if(x == 0 && y == 0){
            zero += 1;
        }else if(x == 0){
            y = 1;
            mp[make_tuple(x, y, 1)]++;
        }else if(y == 0){
            x = 1;
            mp[make_tuple(x, y, 1)]++;
        }else{
            bool pm = ((x > 0) == (y > 0));
            if(x<0) x *= -1;
            if(y<0) y *= -1;
            ll g = gcd(x, y);
            x /= g;
            y /= g;
            mp[make_tuple(x, y, pm)]++;
        }
    }

    mint ans = 1;
    for(auto& t : mp){
        ll a,b;
        bool pm;
        tie(a,b,pm) = t.first;
        int num = t.second;
        if(num<0) continue;
        //cerr << "a = " << a << " b = " << b << " pm = " << pm << " num = " << num << " rev = " << mp[make_tuple(b,a,!pm)] << "\n";
        mint now = 1;
        now += mint(2).pow(num) -1;

        if(a ==0 || b == 0) pm = !pm;
        now += mint(2).pow(mp[make_tuple(b,a,!pm)]) -1;
        ans *= now;

        mp[make_tuple(a,b,pm)] = -1;
        mp[make_tuple(b,a,!pm)] = -1;
    }
    ans -= 1;
    ans += zero;
    cout << ans << endl;
}

Measured memory_bytes: 34820