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

#define rep(i, a, b) for(int i = (a); i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define endl '\n'

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;

const ll mod=1000000007;
//head

pair<ll,ll> normalize(ll a, ll b) {
    pll sardines;
    if(a == b && a == 0) {
        sardines = mp(a,b);
    } else if(a == 0 && b != 0) {
        sardines = mp(0ll,1ll);
    } else if(a != 0 && b == 0) {
        sardines = mp(1ll,0ll); 
    } else if(a < 0 && b < 0) {
        a *= -1;
        b *= -1;
        sardines = mp(a/__gcd(a,b), b/__gcd(a,b));
    } else if(a > 0 && b > 0) {
        ll gcd = __gcd(a,b);
        sardines = mp(a/gcd,b/gcd);
    } else {
        ll gcd = __gcd(abs(a),abs(b));
        sardines = mp(-1*abs(a)/gcd, abs(b)/gcd);
    }
    return sardines;
}
int main()
{
    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);

    int n;
    cin >> n;
    map<pair<ll,ll>, int> cnt;
    vector<pair<ll,ll>> sardines(n); 
    for(int i = 0; i < n; i++) {
        ll a, b;
        cin >> a >> b;
        pair<ll,ll> norm = normalize(a,b);
        if(cnt.count(norm) == 0) {
            cnt[norm] = 1;
        } else {
            cnt[norm]++;
        }
        //cout << norm.first << " " << norm.second << endl;
    }
    /*trav(p, cnt) {
        cout << p.first.first << " " << p.first.second << endl;
    }*/
    ll ans = 1;
    const int nax = 2e5+2;
    ll pow[nax];
    pow[0] = 1;
    set<pair<ll,ll>> counter;
    for(int i = 1; i < nax; i++) pow[i] = (pow[i-1]*2) % mod;
    
    trav(p, cnt) {
        assert(ans >= 0);
        pair<ll,ll> s1 = p.first;
        if(s1.first == 0 && s1.second == 0) continue;
        pair<ll,ll> recip = normalize(-1*s1.second, s1.first);
        if(cnt.count(recip) != 0) {
            ans *= (pow[p.second] + pow[cnt[recip]] - 1) % mod;
            ans %= mod;
        } else {
            ans *= (pow[p.second]);
            ans %= mod;
        }
        cnt.erase(recip);
    }
    if(cnt.count(mp(0ll,0ll)) != 0)
        ans += cnt[mp(0ll,0ll)] - 1;
    ans %= mod;
    cout << ans << endl;

    return 0;
}
