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

//const int mod = 1000000007;
//const int mod = 998244353;
template <typename T, T MOD = 1000000007>
struct Mint {
    static constexpr T mod = MOD;
    T v;
    Mint() : v(0) {}
    Mint(signed v) : v(v) {}
    Mint(long long t) {
        v = t % MOD;
        if (v < 0) v += MOD;
    }

    Mint pow(long long k) {
        Mint res(1), tmp(v);
        while (k) {
            if (k & 1) res *= tmp;
            tmp *= tmp;
            k >>= 1;
        }
        return res;
    }

    static Mint add_identity() { return Mint(0); }
    static Mint mul_identity() { return Mint(1); }

    Mint inv() { return pow(MOD - 2); }

    Mint& operator+=(Mint a) {
        v += a.v;
        if (v >= MOD) v -= MOD;
        return *this;
    }
    Mint& operator-=(Mint a) {
        v += MOD - a.v;
        if (v >= MOD) v -= MOD;
        return *this;
    }
    Mint& operator*=(Mint a) {
        v = 1LL * v * a.v % MOD;
        return *this;
    }
    Mint& operator/=(Mint a) { return (*this) *= a.inv(); }

    Mint operator+(Mint a) const { return Mint(v) += a; }
    Mint operator-(Mint a) const { return Mint(v) -= a; }
    Mint operator*(Mint a) const { return Mint(v) *= a; }
    Mint operator/(Mint a) const { return Mint(v) /= a; }

    Mint operator-() const { return v ? Mint(MOD - v) : Mint(v); }

    bool operator==(const Mint a) const { return v == a.v; }
    bool operator!=(const Mint a) const { return v != a.v; }
    bool operator<(const Mint a) const { return v < a.v; }

    static Mint comb(long long n, int k) {
        Mint num(1), dom(1);
        for (int i = 0; i < k; i++) {
            num *= Mint(n - i);
            dom *= Mint(i + 1);
        }
        return num / dom;
    }
};
template <typename T, T MOD>
constexpr T Mint<T, MOD>::mod;
template <typename T, T MOD>
ostream& operator<<(ostream& os, Mint<T, MOD> m) {
    os << m.v;
    return os;
}
template <typename T, T MOD>
istream& operator>>(istream& os, Mint<T, MOD>& m) {
    os >> m.v;
    return os;
}

using P = pair<long long, long long>;
using Mi = Mint<long long>;

template <typename T>
T gcd(T a, T b) {
    T tmp;
    while (b != 0) {
        tmp = b;
        b = a % b;
        a = tmp;
    }
    return a;
}

int main() {
    int n;
    cin >> n;
    int zero = 0;
    map<P, P> mp;
    for (int i = 0; i < n; ++i) {
        long long x, y;
        cin >> x >> y;
        if (x == 0 && y == 0) {
            zero++;
            continue;
        }
        long long GCD = gcd(abs(x), abs(y));
        x /= GCD;
        y /= GCD;
        if (y < 0) x = -x, y = -y;
        if (y == 0 && x < 0) x = -x, y = -y;
        bool rot90 = (x <= 0);
        if (rot90) {
            // 90度時計回り回転
            long long tmp = x;
            x = y;
            y = -tmp;
        }
        if (rot90)
            mp[{x, y}].first++;
        else
            mp[{x, y}].second++;
    }

    Mi ans(1);
    for (auto& p : mp) {
        int s = p.second.first;
        int t = p.second.second;
        Mi now(1);
        now += Mi(2).pow(s) - 1;
        now += Mi(2).pow(t) - 1;
        ans *= now;
    }
    ans -= 1;
    ans += Mi(zero);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 19188