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

typedef long long ll;
typedef pair<ll,ll> P;

#define p_ary(ary,a,b) do { cout << "["; for (int count = (a);count < (b);++count) cout << ary[count] << ((b)-1 == count ? "" : ", "); cout << "]\n"; } while(0)
#define p_map(map,it) do {cout << "{";for (auto (it) = map.begin();;++(it)) {if ((it) == map.end()) {cout << "}\n";break;}else cout << "" << (it)->first << "=>" << (it)->second << ", ";}}while(0)

template<typename T1,typename T2>ostream& operator<<(ostream& os,const pair<T1,T2>& a) {os << "(" << a.first << ", " << a.second << ")";return os;}

const char newl = '\n';

const ll mod = 1000000007;
//const ll mod = 998244353;

const int MAX_N = 200010;
ll fact[MAX_N],fact_inv[MAX_N],inv[MAX_N];

ll pow_mod(ll a,ll b) {
    ll ret;
    if (b < 0) ret = pow_mod(a,mod+b-1);
    else if (b == 0) ret = 1;
    else if (b == 1) ret = a;
    else {
        ll c = pow_mod(a,b/2);
        if (b%2) ret = (c*c)%mod*a%mod;
        else ret = c*c%mod;
    }
    return ret;
}

void init(int x) {
    fact[0] = 1;fact[1] = 1;
    for (int i = 2;i <= x;++i) fact[i] = fact[i-1]*i%mod;
    fact_inv[x] = pow_mod(fact[x],-1);
    for (int i = x;i > 0;--i) fact_inv[i-1] = fact_inv[i]*i%mod;
    for (int i = 1;i <= x;++i) inv[i] = fact_inv[i]*fact[i-1]%mod;
}

ll combi(ll a, ll b) {
    return fact[a]*fact_inv[b]%mod*fact_inv[a-b]%mod;
}

int main() {
    int n,m = 0;
    cin >> n;
    init(n);
    map<P,int> mp;
    set<P> st;
    for (int i = 0;i < n;++i) {
        ll a,b;
        scanf("%lld%lld",&a,&b);
        if (a == 0 && b == 0) {
            n--;
            m++;
            continue;
        }
        ll g = gcd(abs(a),abs(b));
        a /= g;
        b /= g;
        if (a < 0 || (a == 0 && b < 0)) {
            a *= -1;
            b *= -1;
        }
        mp[make_pair(a,b)]++;
    }
    ll ans = pow_mod(2,n)-1,s = 1;
    for (auto p : mp) {
        P q = make_pair(p.first.second,-p.first.first);
        if (q.first < 0) {
            q.first *= -1;
            q.second *= -1;
        }
        if (mp.find(q) == mp.end() || st.find(p.first) != st.end()) continue;
        n -= p.second+mp[q];
        (ans -= (pow_mod(2,p.second)-1)*(pow_mod(2,mp[q])-1)%mod*(pow_mod(2,n)*s%mod)%mod) %= mod;
        st.insert(p.first);
        st.insert(q);
        (s *= (pow_mod(2,p.second+mp[q])-(pow_mod(2,p.second)-1)*(pow_mod(2,mp[q])-1)%mod)%mod) %= mod;
    }
    cout << (ans+m+mod)%mod << endl;
}