#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
constexpr int MOD = 1000000007;
constexpr int INF = numeric_limits<int>::max() / 2;
typedef pair<int,int> P;
using Graph = vector<vector<int>>;

int modpow(int x, int n, int mod) {
    int res = 1;
    while (n > 0) {
        if (n & 1) {  // nが奇数のとき
            res *= x;
            res %= mod;
        }
        x *= x;
        x %= mod;
        n >>= 1;
    }
    return res;
}
 
 
signed main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
 
	int N;
	cin >> N;
    map<P, int> mp;
	rep(i,N){
		int a, b;
        cin >> a >> b;
        if(a == 0 && b == 0){
            mp[{0,0}]++;
        }
        else if(a == 0){
            mp[{0,1}]++;
        }
        else if(b == 0){
            mp[{1,0}]++;
        }
        else{
            int gc = __gcd(a, b);
            a /= gc;
            b /= gc;
            if(a > 0 && b > 0){
                mp[{a,b}]++;
            }
            else if(a < 0 && b < 0){
                mp[{-a, -b}]++;
            }
            else if(a < 0){
                mp[{a,b}]++;
            }
            else if(b < 0){
                mp[{-a, -b}]++;
            }
        }
	}
    int ans = 1;
    /*
    for(auto e : mp){
        cout << e.first.first << ' ' << e.first.second << ' ' << e.second << endl;
    }
    */
    for(auto e : mp){
        int x = e.first.first;
        int y = e.first.second;
        // int z = e.second;
        int cnt = 1;
        if(x == 0 && y == 0){
            continue;
        }
        else if(x == 0 || y == 0){
            int z1 = mp[{0,1}];
            int z2 = mp[{1,0}];
            if(z1 == 0 && z2 == 0) continue;
            cnt = modpow(2,z1,MOD) + modpow(2,z2,MOD) -1;
            mp[{0,1}] = 0;
            mp[{1,0}] = 0;
        }
        else if(x > 0 && y > 0){
            int z1 = mp[{x,y}];
            int z2 = mp[{-y,x}];
            if(z1 == 0 && z2 == 0) continue;
            cnt = modpow(2,z1,MOD) + modpow(2,z2,MOD) -1;
            mp[{x,y}] = 0;
            mp[{-y,x}] = 0;
        }
        else{
            int z1 = mp[{x,y}];
            int z2 = mp[{y,-x}];
            if(z1 == 0 && z2 == 0) continue;
            cnt = modpow(2,z1,MOD) + modpow(2,z2,MOD) -1;
            mp[{x,y}] = 0;
            mp[{y,-x}] = 0;
        }
        ans *= cnt;
        ans %= MOD;
    }
    ans = (ans-1+mp[{0,0}]) % MOD;
    cout << ans << endl;
}