#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T, class U> using Pa = pair<T, U>;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;


constexpr ll mod = 1e9+7;
struct mint {
    ll x;
    mint(ll x=0):x((x%mod+mod)%mod){}
    
    friend ostream &operator<<(ostream& os,const mint& a){
        return os << a.x;
    }

    friend istream &operator>>(istream& is,mint& a){
        ll t;
        is >> t;
        a = mint(t);
        return (is);
    }

    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(ll 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;
    }
};

using P = Pa<ll,ll>;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    map<P,ll> mp;
    ll zero = 0;;
    for(int i=0;i<N;i++){
        ll a,b;
        cin >> a >> b;
        if(a==0 && b==0){
            zero++;
        }else if(a==0){
            mp[{0,1}]++;
        }else if(b==0){
            mp[{1,0}]++;
        }else{
            ll g = gcd(abs(a),abs(b));
            a /= g,b /= g;
            if(a<0){
                a *= -1;
                b *= -1;
            }
            mp[{a,b}]++;
        }
    }
    mint res = 1;
    set<P> s;
    for(auto p:mp){
        auto [a,b] = p.first;
        if(s.count(p.first)) continue;
        int c = -b,d = a;
        if(c<0){
            c *= -1;
            d *= -1;
        }
//        cerr << a << " " << b << " " << c << " " << d << "\n";
        if(mp.count({c,d})){
            res *= (mint (2)).pow(p.second)+(mint (2)).pow(mp[{c,d}])-1;
            s.insert({c,d});
        }else{
            res *= (mint (2)).pow(p.second);
        }
    }
    res += zero;
    cout << res-1 << "\n";
}