#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
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;
}

const long long INF = 1e18;
const ll mod = 1000000007;
vector<ll> inv, FactorialInv, Factorial;
ll beki(ll a, ll b){
    ll ret = 1 % mod;
    a %= mod;
    while(b) {
        if(b & 1LL) ret = ret * a % mod;
        a = a * a % mod;
        b >>= 1;
    }
    return ret;
}
void init_combination(ll MAX){
    Factorial.resize(MAX + 1);
    FactorialInv.resize(MAX + 1);
    inv.resize(MAX + 1);
    Factorial[0] = 1;
    inv[0] = 1;
    for(int i = 1; i <= MAX; i++){
        Factorial[i] = Factorial[i - 1] * i % mod;
    }
    FactorialInv[MAX] = beki(Factorial[MAX], mod - 2);
    for(ll i = MAX - 1; i >= 0; i--) {
        FactorialInv[i] = FactorialInv[i+1] * (i+1) % mod;
    }
    for(int i = 1; i <= MAX; i++) {
        inv[i] = FactorialInv[i] * Factorial[i-1] % mod;
    }
}
ll combination(ll a, ll b){
    if((a == b) || (b == 0)){
        return 1;
    }
    if(a < b) return 0;
    if(b < 0) return 0;
    ll ans = Factorial[a] * FactorialInv[b] % mod;
    ans = ans * FactorialInv[a - b] % mod;
    return ans;
}

ll ans;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    map<l_l, l_l> mp;
    ll num = 0;
    for(int i = 0; i < N; i++) {
        ll a, b;
        cin >> a >> b;
        if(a == 0 and b == 0) {
            ans++;
            continue;
        }
        num++;
        ll g = __gcd(abs(a), abs(b));
        a /= g;
        b /= g;
        if(a < 0) {
            a *= -1;
            b *= -1;
        } else if(a == 0 and b < 0) {
            a *= -1;
            b *= -1;
        }
        if(b < 0) {
            mp[{-b, a}].second++;
        } else if(b == 0) {
            mp[{0, 1}].second++;
        } else if(a == 0) {
            mp[{0, 1}].first++;
        } else {
            mp[{a, b}].first++;
        }
    }
    ans %= mod;
    ll tmp = 1;
    for(auto tmp2 : mp) {
        ll a = tmp2.second.first;
        ll b = tmp2.second.second;
        ll factor = 1;
        factor += beki(2, a) - 1;
        factor += beki(2, b) - 1;
        factor += mod;
        factor += mod;
        factor %= mod;
        tmp *= factor;
        tmp %= mod;
    }
    tmp--;
    ans += tmp;
    ans %= mod;
    cout << ans << endl;
    return 0;
}
