//--------------------------------------------------
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,abm,mmx,avx,avx2,popcnt,fma")
#pragma GCC optimize("fast-math")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC optimize("Ofast")
//--------------------------------------------------
#include <bits/stdc++.h>
#include <chrono>
#include <set>
#include <map>
#include <deque>
#include <cmath>
#include <queue>
#include <cassert>
#include <random>
#include <bitset>
#include <iomanip>
#include <numeric>
#include <time.h>
#include <ctime>
#include <string>
#include <cstdio>
#include <vector>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <fstream>
#include <stack>
#include <cstring>
//--------------------------------------------------
#define forn(i, n) for(int i = 0; i < n; i++)
#define forw(i, n) for(int i = n-1; i >= 0; --i)
#define forns(i, n, s) for(int i = s; i < n; i++)
#define x first
#define y second
#define pb push_back
#define mp make_pair
#define all(v) v.begin(),v.end()
#define allr(v) v.rbegin(),v.rend()
//----------------------------------------------------
using namespace std;
//----------------------------------------------------
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef long double ld;
typedef vector<ll> lnum;
typedef complex<ld> comp;
//----------------------------------------------------
const ll mod = 1e9 + 7, mod2 = 998244353;
const ld eps = 1e-6;
const ll inf = 1e18;
const int base = 1e9;
const ld PI = 3.1415926;
//----------------------------------------------------
#define endl '\n';
#ifdef MY_DEBUG
void deb(ld x) { cerr << x << endl; };
#else
void deb(ld x){};
#endif
//----------------------------------------------------
ll fact[2*100*1001];
int n;
ll a[2*100*1000], b[2*100*1000];
ll ans = 1;
//----------------------------------------------------
unsigned int bitcount(ull val) { return __builtin_popcount(val) + __builtin_popcount(val >> 32); }

void local() {
    freopen("test.in", "r", stdin);
}

void remote() {
}

void read() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cin >> n;
    forn(i, n) cin >> a[i] >> b[i];
}

ll binpow(ll val, ll pow){
    ll res = 1;
    while(pow > 0){
        if(pow & 1) res *= val, res %= mod;
        val *= val, val %= mod;
        pow >>= 1;
    }
    return res;
}

ll binomial(ll n, ll k){
    return n < k ? 0 : (((fact[n] * binpow(fact[k], mod-2)) % mod) * binpow(fact[n-k], mod-2)) % mod;
}

int main() {
#ifdef MY_DEBUG
    local();
#else
    remote();
#endif
    read();

    fact[0] = 1;
    forns(i, n+1, 1) fact[i] = (fact[i-1] * i) % mod;

    map<pair<ll, ll>, pair<ll, ll>> m;
    int z = 0;
    forn(i, n){

        if(!a[i] && !b[i]){
            z++;
            continue;
        }

        if(b[i] < 0)
            a[i] = -a[i], b[i] = -b[i];

        a[i] /= gcd(a[i], b[i]);
        b[i] /= gcd(a[i], b[i]);

        if(b[i] == 0 && a[i] < 0) a[i] = -a[i];

        if(a[i] > 0) m[{a[i], b[i]}].x++;
        else m[{b[i], -a[i]}].y++;
    }

    for(auto &[key, val]: m)
        ans *= (binpow(2, val.x) + binpow(2, val.y) - 1 + mod) % mod, ans %= mod;

    cout << (ans + z - 1 + mod) % mod << endl;
}