
// Problem : E - ∙ (Bullet)
// Contest : AtCoder - AtCoder Beginner Contest 168
// URL : https://atcoder.jp/contests/abc168/tasks/abc168_e
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

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

#ifdef LOCAL
#define DEBUG(...) debug(#__VA_ARGS__, __VA_ARGS__);
#else
#define DEBUG(...)
#endif

template<typename T, typename S> ostream& operator << (ostream &os, const pair<T, S> &p) {return os << "(" << p.first << ", " << p.second << ")";}
template<typename C, typename T = decay<decltype(*begin(declval<C>()))>, typename enable_if<!is_same<C, string>::value>::type* = nullptr>
ostream& operator << (ostream &os, const C &c) {bool f = true; os << "["; for (const auto &x : c) {if (!f) os << ", "; f = false; os << x;} return os << "]";}
template<typename T> void debug(string s, T x) {cerr << s << " = " << x << "\n";}
template<typename T, typename... Args> void debug(string s, T x, Args... args) {cerr << s.substr(0, s.find(',')) << " = " << x << " | "; debug(s.substr(s.find(',') + 2), args...);}

const int MOD = 1e9 + 7;

void add(int &a, int b) {
    a += b;
    if (a >= MOD)
        a -= MOD;
}

void sub(int &a, int b) {
    a -= b;
    if (a < 0)
        a += MOD;
}

int mul(int a, int b) {
    return (long long) a * b % MOD;
}

int power[200001];

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    
    int n;
    cin >> n;
    
    power[0] = 1;
    for (int i=0; i<n; i++)
        power[i+1] = mul(power[i], 2);
    
    int cntA = 0, cntB = 0;
    map<pair<long long, long long>, int> mp1, mp2;
    for (int i=0; i<n; i++) {
        long long a, b;
        cin >> a >> b;
        
        if (a == 0 && b != 0) {
            cntA++;
        } else if (a != 0 && b == 0) {
            cntB++;
        } else if (a != 0 && b != 0) {
            long long d = __gcd(a, b);
            a /= d;
            b /= d;
            
            if (b < 0) {
                a = -a;
                b = -b;
            }
            if (a > 0)
                mp1[{a, b}]++;
            else
                mp2[{a, b}]++;
        }
    }
    
    int ret = power[cntA];
    add(ret, power[cntB]);
    sub(ret, 1);
    for (auto p : mp1) {
        long long a = p.first.first, b = p.first.second;        
        int product = power[p.second];
        add(product, power[mp2[{-b, a}]]);
        sub(product, 1);
        ret = mul(ret, product);
        mp2.erase({-b, a});
    }
    for (auto p : mp2)
        ret = mul(ret, power[p.second]);
    sub(ret, 1);
    
    cout << ret << "\n";

    return 0;
}
