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

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

template <typename T>
struct fraction {
    T a, b;
    fraction(T _a, T _b) {
        a = _a, b = _b;
        if (a != 0 && b != 0) {
            T GCD = gcd(abs(a), abs(b));
            //cout << "a:" << a << " b:" << b << " GCD:" << GCD << endl;
            a /= GCD, b /= GCD;
            if (a < 0) a *= -1, b *= -1;
        } else if (a != 0) {
            a = 1, b = 0;
        } else if (b != 0) {
            a = 0, b = 1;
        } else {
            // a == 0 && b == 0
            ;
        }
    }

    bool operator==(const fraction& obj) const { return a == obj.a && b == obj.b; }
    bool operator<(const fraction& obj) const { return (a < obj.a) || (!(a < obj.a) && b < obj.b); }
};

//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;
}

// ここから書く
typedef fraction<long long> fll;
typedef Mint<long long> Mi;

pair<long long, long long> Fraction(long long a, long long b) {
    pair<long long, long long> res;
    if (a != 0 && b != 0) {
        long long GCD = gcd(abs(a), abs(b));
        a /= GCD, b /= GCD;
        if (a < 0) a *= -1, b *= -1;
    } else if (a != 0) {
        a = 1, b = 0;
    } else if (b != 0) {
        a = 0, b = 1;
    } else {
        // a == 0 かつ b == 0の場合
        ;
    }
    res.first = a, res.second = b;
    return res;
}

typedef pair<long long, long long> pll;

int main() {
    int N;
    cin >> N;
    map<pll, int> Map;
    map<pll, bool> Visited;
    for (int i = 0; i < N; ++i) {
        long long A, B;
        cin >> A >> B;
        auto tmp = Fraction(A, B);
        ++Map[tmp];
        Visited[tmp] = false;
    }

    Mi res(1);
    for (auto& p : Map) {
        //cout << p.first.first << ":" << p.first.second << ":" << p.second << endl;
        if (p.first == Fraction(0, 0)) {
            // あとで処理する
            continue;
        }

        pll Pair = Fraction(-p.first.second, p.first.first);
        if (Map.find(Pair) != Map.end()) {
            if (Visited[Pair]) continue;
            long long S = p.second;
            long long T = Map[Pair];
            Mi R(0);
            R += Mi(2).pow(S) - Mi(1);  // Sのみ1匹以上
            R += Mi(2).pow(T) - Mi(1);  // Tのみ1匹以上
            R += Mi(1);                 // どちらも選ばない
            res *= R;
            Visited[p.first] = Visited[Pair] = true;
        } else {
            // 相方が見つからなかった場合
            Mi R(0);
            long long S = p.second;
            R += Mi(2).pow(S);
            res *= R;
        }
    }
    res -= Mi(1);  // どのグループから1つも選ばない場合を引く
    if (Map.find(Fraction(0, 0)) != Map.end()) {
        res += Mi(Map[Fraction(0, 0)]);
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 28528