#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 2e5 + 5, mod = 1e9 + 7;

ll add(ll a, ll b){
    a = (a + mod) % mod;
    b = (b + mod) % mod;
    return (a + b) % mod;
}

int mul(ll a, ll b){
    a = (a + mod) % mod;
    b = (b + mod) % mod;
    return 1LL * a * b % mod;
}

int fp(int b, int p){
    if(!p) return 1;
    int ret = fp(b, p >> 1) % mod;
    ret = mul(ret, ret);
    if(p&1) ret = mul(ret, b);
    return ret;
}
vector<pair<ll, ll> > p;
map<pair<ll, ll>, ll> mp, mp2, mp3;
int n, dp[N];


int solve(int idx){
    if(idx == n) return 1;
    if(dp[idx] != -1) return dp[idx];
    int op1 = solve(idx + 1);
    int op2 = 0, op3 = 0;
    if(mp.find(p[idx]) != mp.end()) op2 = mul(add(-1, fp(2, mp[p[idx]])), solve(idx + 1));
    if(mp2.find(p[idx]) != mp2.end()) op3 = mul(add(-1, fp(2, mp2[p[idx]])), solve(idx + 1));
    return dp[idx] = add(add(op1, op2), op3);
}


int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    cin >> n;
    vector< pair<ll, ll> > v;
    for(int i = 0; i < n; i++){
        ll a, b;
        cin >> a >> b;
        if(!a && !b) continue;
        v.push_back({a, b});
    }
    n = v.size();
    for(int i = 0; i < n; i++){
        auto p = v[i];
        if(!p.first || !p.second){
            if(!p.first) mp[{0, 1}]++;
            else mp2[{0, 1}]++;
            continue;
        }
        ll a = p.first, b = p.second;
        bool found = 0;
        if(a > 0 && b > 0) found = 1;
        if(a < 0 && b < 0) found = 1;
        a = abs(a);
        b = abs(b);
        ll g = __gcd(a, b);
        a /= g;
        b /= g;
        if(found) mp[{a, b}]++;
        else mp2[{b, a}]++;
    }
    for(auto i: mp) mp3[i.first] = 1;
    for(auto i: mp2) mp3[i.first] = 1;
    for(auto i: mp3) p.push_back(i.first);
    // for(auto i: p) cout << i.first << ' ' << i.second << "  " << mp[i] << ' ' << mp2[i] << '\n';
    n = p.size();
    memset(dp, -1, sizeof dp);
    cout << add(-1, solve(0));


    return 0;

}
