/**
 *   @FileName	e.cpp
 *   @Author	kanpurin
 *   @Created	2020.05.17 23:28:31
**/

#include "bits/stdc++.h" 
using namespace std; 
typedef long long ll;

constexpr int MOD = 1e9 + 7;
struct mint {
private:
    long long x;
public:
    mint(long long x = 0) : x((MOD + x) % MOD) {}
    mint(std::string& s) {
        long long z = 0;
        for (int i = 0; i < s.size(); i++) {
            z *= 10;
            z += s[i] - '0';
            z %= MOD;
        }
        this->x = z;
    }
    mint& operator+=(const mint& a) {
        if ((x += a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint& operator-=(const mint& a) {
        if ((x += MOD - a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint& operator*=(const mint& a) {
        (x *= a.x) %= MOD;
        return *this;
    }
    mint& operator/=(const mint& a) {
        long long n = MOD - 2;
        mint u = 1, b = a;
        while (n > 0) {
            if (n & 1) {
                u *= b;
            }
            b *= b;
            n >>= 1;
        }
        return *this *= u;
    }
    mint operator+(const mint& a) const {
        mint res(*this);
        return res += a;
    }
    mint operator-(const mint& a) const {
        mint res(*this);
        return res -= a;
    }
    mint operator*(const mint& a) const {
        mint res(*this);
        return res *= a;
    }
    mint operator/(const mint& a) const {
        mint res(*this);
        return res /= a;
    }
    friend std::ostream& operator<<(std::ostream& os, const mint& n) {
        return os << n.x;
    }
    bool operator==(const mint& a) const {
        return this->x == a.x;
    }
};
// gcd
template < typename T >
T gcd(T a, T b) {
    return b ? gcd(b, a % b) : a;
}
// pow
template < typename T, typename U >
T pow(T k, U n, T unity = 1) {
    while (n > 0) {
        if (n & 1) {
            unity *= k;
        }
        k *= k;
        n >>= 1;
    }
    return unity;
}
int main() {
    int n;
    cin >> n;
    map< pair< ll, ll >, int > mp;
    int zero_cnt = 0;
    int nashi = 0;
    map< pair< int, int >, bool > used;
    for (int i = 0; i < n; i++) {
        ll a, b;
        cin >> a >> b;
        if (a == 0 && b == 0)
            zero_cnt++;
        else if (a < 0 && b < 0) {
            a *= -1;
            b *= -1;
            ll g = gcd(a, b);
            a /= g;
            b /= g;
            mp[{a, b}]++;
            used[{a, b}] = false;
        } else if (a > 0 && b > 0) {
            ll g = gcd(a, b);
            a /= g;
            b /= g;
            mp[{a, b}]++;
            used[{a, b}] = false;
        } else if (a > 0 && b < 0) {
            b *= -1;
            ll g = gcd(a, b);
            a /= g;
            b /= g;
            mp[{a, -b}]++;
            used[{a, -b}] = false;
        } else if (b > 0 && a < 0) {
            a *= -1;
            ll g = gcd(a, b);
            a /= g;
            b /= g;
            mp[{a, -b}]++;
            used[{a, -b}] = false;
        } else if (a == 0) {
            mp[{0, 1}]++;
            used[{0, 1}] = false;
        } else if (b == 0) {
            mp[{1, 0}]++;
            used[{1, 0}] = false;
        }
    }
    mint ans = 1;
    for (auto pp : mp) {
        if (used[pp.first]) continue;
        //cout << pp.first.first << " " << pp.first.second << " " << pp.second << endl;
        //cout << "!" << nashi << endl;
        if (pp.first.first == 1 && pp.first.second == 0) {
            // ある
            if (mp.find({0, 1}) != mp.end()) {
                ans *= pow(mint(2), mp[pp.first]) + pow(mint(2), mp[{0, 1}]) - 1;
                used[{0, 1}] = true;
            } else {
                nashi += mp[pp.first];
            }
        } else if (pp.first.first == 0 && pp.first.second == 1) {
            // ある
            if (mp.find({1, 0}) != mp.end()) {
                ans *= pow(mint(2), mp[pp.first]) + pow(mint(2), mp[{1, 0}]) - 1;
                used[{1, 0}] = true;
            } else {
                nashi += mp[pp.first];
            }
        } else if (pp.first.second < 0) {
            // ある
            if (mp.find({-pp.first.second, pp.first.first}) != mp.end()) {
                ans *= pow(mint(2), mp[pp.first]) + pow(mint(2), mp[{-pp.first.second, pp.first.first}]) - 1;
                used[{-pp.first.second, pp.first.first}] = true;
            } else {
                nashi += mp[pp.first];
            }
        } else if (pp.first.second > 0) {
            // ある
            if (mp.find({pp.first.second, -pp.first.first}) != mp.end()) {
                ans *= pow(mint(2), mp[pp.first]) + pow(mint(2), mp[{pp.first.second, -pp.first.first}]) - 1;
                used[{pp.first.second, -pp.first.first}] = true;
            } else {
                nashi += mp[pp.first];
            }
        }
    }
    ans *= pow(mint(2),nashi);
    cout << ans - 1 + zero_cnt << endl;
    return 0;
}

Measured memory_bytes: 28640