#include <bits/stdc++.h>
using namespace std;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<long long> VL;
typedef vector<vector<long long>> VVL;
typedef vector<string> VS;
typedef pair<ll,ll> P;
typedef tuple<int,int,int> tpl;

#define ALL(a)  (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())
#define LB(a,x) lower_bound((a).begin(), (a).end(), x) - (a).begin()
#define UB(a,x) upper_bound((a).begin(), (a).end(), x) - (a).begin()

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);--i)
#define RREP(i,n) RFOR(i,n,0)

#define en "\n"

constexpr double EPS = 1e-9;
constexpr double PI  = 3.1415926535897932;
constexpr int INF = 2147483647;
constexpr long long LINF = 1LL<<60;
constexpr long long MOD = 1000000007; // 998244353;

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { 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;
    }
};

void Main(){
    int N; cin >> N;
    mint ans(1);
    vector<mint> p(N+1); p[0] = 1; REP(i,N) p[i+1] = p[i]*2;
    map<P,ll> m;
    ll z = 0;
    REP(i,N){
        ll a,b; cin >> a >> b;
        if(a==0 && b==0){
            z++;
            continue;
        }
        ll g = gcd(a,b);
        a /= g; b /= g;
        if(a<0){
            a *= -1; b *= -1;
        }
        if(a==0 && b<0) b *= -1;

        if(m.find(P(a,b)) != m.end()) m[P(a,b)]++;
        else m[P(a,b)] = 1;
    }

    for(auto pp : m){
        P arg = pp.first;
        ll n = pp.second;
        if(arg.first==0 && arg.second==0) continue;
        if(arg.second <= 0){
            ll a = -arg.second;
            ll b = arg.first;
            if(m.find(P(a,b)) != m.end()) continue;
            ans *= p[n];
        }
        else{
            ll a = arg.second;
            ll b = -arg.first;
            ll t1 = n, t2 = 0;
            if(m.find(P(a,b)) != m.end()) t2 = m[P(a,b)];

            ans *= p[t1]+p[t2]-1;
        }
    }

    ans += z;
    ans -= 1;

    cout << ans.x << en;
    return;
}

int main(void){
    cin.tie(0);ios_base::sync_with_stdio(0);cout<<fixed<<setprecision(15);
    int t = 1; //cin >> t;
    REP(_,t){
        Main();
    }
    return 0;
}

Measured memory_bytes: 17012