#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize(2)
#pragma G++ optimize(2)

#include <bits/stdc++.h>

#define LL long long
#define int long long
#define fi first
#define se second
#define pii pair<int, int>
#define pll pair<LL, LL>
#define pdd pair<double, double>
#define fastio ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define length(p1, p2) ((p1.fi-p2.fi)*(p1.fi-p2.fi)+(p1.se-p2.se)*(p1.se-p2.se))
#define ith(state, i) (state & (1 << i))
#define PI acos(-1.0)

using namespace std;

constexpr int N = 2e5+9;
constexpr int M = 1e9+7;
constexpr int INF = 0x3f3f3f3f3f3f3f3f;
constexpr int INF2 = 0xcfcfcfcfcfcfcfcf;

namespace Math {
    template <class T> struct Fraction {
        T x, y;
        Fraction(): Fraction(1, 1) {}
        Fraction(T a, T b) : x(a), y(b) {
            if (y == 0) {
                if (a > 0) a = 1;
                else if (a < 0) a = -1;
                return;
            }
            if (y < 0) x = -x, y = -y;
            bool neg = false;
            if (x < 0) neg = true, x = -x;
            int g = gcd(x, y);
            if (g != 1)
                x /= g, y /= g;
            if (neg) x = -x;
        }
        bool isInf(bool positive) const {
            return y == 0 && ((positive && x > 0) || (!positive && x < 0));
        }
        bool isNan() const {
            return x == 0 && y == 0;
        }
        Fraction Nan() const {
            return Fraction(0, 0);
        }
        Fraction Inf(bool positive) const {
            if (positive) return Fraction(1, 0);
            else return Fraction(-1, 0);
        }
        Fraction operator + (const Fraction& f) const {
            if (f.isInf(true) && isInf(false) || f.isInf(false) && isInf(true))
                return Nan();
            if (f.isNan() || isNan()) return Nan();
            if (f.isInf(true) || isInf(true)) return Inf(true);
            if (f.isInf(false) || isInf(false)) return Inf(false);
            Fraction res;
            T y1 = y / gcd(f.y, y) * f.y;
            T x1 = y1 / y * x + y1 / f.y * f.x;
            return Fraction(x1, y1);
        };
        Fraction operator - () const {
            return Fraction(-x, y);
        }
        Fraction operator - (const Fraction& f) const {
            return *this + (- f);
        }
        Fraction operator * (const Fraction& f) const {
            if (isNan() || f.isNan() || isInf(true) || isInf(false) || f.isInf(true) || f.isInf(false))
                return Nan();
            return Fraction(x * f.x, y * f.y);
        }
        Fraction operator / (const Fraction& f) const {
            if (isNan() || f.isNan() || isInf(true) || isInf(false) || f.isInf(true) || f.isInf(false))
                return Nan();
            return *this * Fraction(f.y, f.x);
        }
        bool operator < (const Fraction& f) const {
            Fraction res = *this - f;
            return res.x < 0;
        }
        bool operator == (const Fraction& f) const {
            return f.x == x && f.y == y;
        }
        Fraction& operator = (const Fraction& f) {
            x = f.x, y = f.y;
            return *this;
        }
    };
}

map<Math::Fraction<int>, int> m;
int n;
int a, b;
int zeroA, zeroB, zeroBoth;
int po[N];

signed main() {
    fastio;
    cin >> n;
    int ans = 0;
    po[0] = 1;
    for (int i = 1; i <= n; i++) {
        po[i] = po[i-1] * 2 % M;
        cin >> a >> b;
        if (a == 0 && b == 0) {
            zeroBoth++;
        } else if (a == 0) {
            zeroA++;
        } else if (b == 0) {
            zeroB++;
        } else {
            m[Math::Fraction(a, b)]++;
        }
    }
    int other = n - zeroA - zeroB - zeroBoth;
    if (zeroA)
        ans += po[zeroA-1] * po[other] % M, ans %= M;
    if (zeroB)
        ans += po[zeroB] * po[other] % M, ans %= M;
    int o = 1;
    for (auto& p: m) {
        Math::Fraction<int> f(-p.fi.y, p.fi.x);
        if (m.count(f) && p.fi.x > 0) {
            o *= (po[p.se] + po[m[f]] - 1) % M;
        } else if (!m.count(f)) {
            o *= po[p.se];
        }
        o %= M;
    }
    ans = (o + ans - 1) % M;
    cout << ans << endl;
    return 0;
}