#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

long long gcd(long long a, long long b)
{
    a = abs(a), b = abs(b);
    if (a < b) swap(a, b);
    if (b == 0)
        return a;
    else {
        return gcd(b, a % b);
    }
}

using ll = long long;
using P = pair<int, int>;

// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 1000000007;
struct mint {
    ll x;  // typedef long long ll;
    mint(ll x = 0) : x((x % mod + mod) % mod) {}
    mint operator-() const { return mint(-x); }
    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) const { return mint(*this) += a; }
    mint operator-(const mint a) const { return mint(*this) -= a; }
    mint operator*(const mint a) const { return mint(*this) *= a; }
    mint pow(ll t) const
    {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const { return pow(mod - 2); }
    mint& operator/=(const mint a) { return *this *= a.inv(); }
    mint operator/(const mint a) const { return mint(*this) /= a; }
};

int main()
{
    // const int mod = 1000000007;
    int n;
    cin >> n;
    using pll = pair<long long, long long>;
    using pii = pair<int, int>;
    map<pll, pii> mp;
    int zero = 0;
    for (int i = 0; i < n; i++) {
        long long a, b;
        cin >> a >> b;
        if (a == 0 & b == 0) {
            zero++;
            continue;
        }
        auto g = gcd(a, b);
        a /= g;
        b /= g;

        if (b < 0) a = -a, b = -b;
        if (b == 0 && a < 0) a = -a, b = -b;
        bool rot90 = (a <= 0);
        if (rot90) {
            auto tmp = a;
            a = b, b = -tmp;
        }
        if (rot90)
            mp[{a, b}].first++;
        else
            mp[{a, b}].second++;
    }
    /*
        modint<int> ans{1};
        for (const auto& p : mp) {
            auto rotated = p.second.first;
            auto unrotated = p.second.second;
            modint<int> now{1};
            now += modint<int>{2}.pow(rotated) - 1;
            now += modint<int>{2}.pow(unrotated) - 1;
            ans *= now;
        }
        */
    mint ans{1};
    for (const auto& p : mp) {
        auto rotated = p.second.first;
        auto unrotated = p.second.second;
        mint now{1};
        now += mint{2}.pow(rotated) - 1;
        now += mint{2}.pow(unrotated) - 1;
        ans *= now;
    }
    ans -= 1;
    ans += zero;
    cout << ans.val() << endl;
    return 0;
}
