/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author cherrypi59
 */

#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define FFOR(i, a, b) FOR(i, a, b+1)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) FOR(i, 1, n+1)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define LEN(x) (int)(x).size()
#define DUMP(x) cerr<<__LINE__<<' '<<#x<<"="<<(x)<<endl;
#define pb push_back
#define eb emplace_back
#define mp make_pair

using namespace std;
using lint = long long;
using pii =  pair<int, int>;
using pll =  pair<lint, lint>;
template <typename T> using vc = vector<T>;
template <typename T> using vvc = vector<vector<T>>;
template <typename T> inline bool chmax(T &a, T b){if(a<b){a = b; return true;} return false;}
template <typename T> inline bool chmin(T &a, T b){if(a>b){a = b; return true;} return false;}

constexpr lint ten(int n) {return n==0 ? 1 : ten(n-1)*10;}

struct mint {
    long long x;
    static constexpr long long MOD = (long long)1e9 + 7;

    mint(long long x=0):x((x%MOD+MOD)%MOD){}

    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 {
        mint res = 1, a(*this);
        while(t){
            if(t&1) res *= a;
            t >>= 1, a *= a;
        }
        return res;
    }
    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 istream& operator>>(istream& in, mint& a){
        long long _v; in>>_v;
        a = mint(_v);
        return in;
    }
    friend ostream& operator<<(ostream& out, const mint& a){
        return out<<a.x;
    }
    friend bool operator==(const mint& a, const mint& b){
        return a.x == b.x;
    }
    friend bool operator!=(const mint& a, const mint& b){
        return a.x != b.x;
    }
};

class EBullet {
public:
    void solve(std::istream& in, std::ostream& out){
        ios_base::sync_with_stdio(false);
        in.tie(nullptr), out.tie(nullptr);
        int N;
        lint zz = 0, zx = 0, xz = 0;
        in>>N;
        map<pll, lint> MP;
        REP(i, N){
            lint a, b;
            in>>a>>b;
            if(a==0 and b==0){
                ++zz;
            }else if(a==0){
                ++zx;
            }else if(b==0){
                ++xz;
            }else{
                lint g = __gcd(a, b);
                a /= g, b /= g;
                if(b<0) a *= -1, b *= -1;
                MP[pll(a, b)]++;
            }
        }
        set<pll> S;
        mint ans = 1;
        for(auto& p : MP){
            if(S.count(p.first)) continue;
            lint a = p.first.first, b = p.first.second;
            if(a<0) a *= -1, b *= -1;
            auto itr = MP.find({-b, a});
            lint cnt = itr == MP.end() ? 0 : itr->second;
            if(cnt==0) ans *= mint(2).pow(p.second);
            else ans *= (mint(2).pow(p.second)+mint(2).pow(cnt)-1);
            S.insert({-b, a});
        }
        ans *= (mint(2).pow(zx)+mint(2).pow(xz)-1);
        if(zz){
            ans += zz;
        }
        out<<ans-1<<'\n';
    }
};


int main() {
	EBullet solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 28604