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

template <long long mod>
class Mod
{
    long long value;
    void set_value(const long long x)
    {
        this->value = x % mod;
    }

public:
    Mod()
    {
        set_value(0ll);
    }

    template <typename T>
    Mod(T x = 0)
    {
        set_value((long long)x);
    }

    friend istream &operator>>(istream &is, Mod &x)
    {
        long long tmp;
        is >> tmp;
        x.set_value(tmp);
        return is;
    }

    friend ostream &operator<<(ostream &os, const Mod &x)
    {
        os << x.value;
        return os;
    }

    operator long long() const
    {
        return this->value;
    }

    template <typename T>
    bool operator<(const T x)
    {
        return this->value < (long long)x;
    }

    template <typename T>
    bool operator<=(const T x)
    {
        return this->value <= (long long)x;
    }

    template <typename T>
    bool operator>(const T x)
    {
        return this->value > (long long)x;
    }

    template <typename T>
    bool operator>=(const T x)
    {
        return this->value >= (long long)x;
    }

    template <typename T>
    bool operator==(const T x)
    {
        return this->value == (long long)x;
    }

    template <typename T>
    Mod &operator=(const T x)
    {
        set_value((long long)x);
        return *this;
    }

    template <typename T>
    Mod &operator&=(const T x)
    {
        set_value(this->value & (long long)x);
        return *this;
    }

    template <typename T>
    Mod &operator|=(const T x)
    {
        set_value(this->value | (long long)x);
        return *this;
    }

    template <typename T>
    Mod &operator^=(const T x)
    {
        set_value(this->value ^ (long long)x);
        return *this;
    }

    template <typename T>
    Mod &operator<<=(const T x)
    {
        set_value(this->value << (long long)x);
        return *this;
    }

    template <typename T>
    Mod &operator>>=(const T x)
    {
        set_value(this->value >> (long long)x);
        return *this;
    }

    template <typename T>
    Mod &operator+=(const T x)
    {
        set_value(this->value + (long long)x);
        return *this;
    }

    template <typename T>
    Mod &operator-=(const T x)
    {
        set_value(this->value - (long long)x + mod);
        return *this;
    }

    template <typename T>
    Mod &operator*=(const T x)
    {
        set_value(this->value * (long long)x);
        return *this;
    }

    template <typename T>
    Mod &operator/=(const T x)
    {
        long long a = (long long)x;
        long long b = mod;
        long long u = 1;
        long long v = 0;
        while (b)
        {
            long long t = a / b;
            a -= t * b;
            swap(a, b);
            u -= t * v;
            swap(u, v);
        }
        u %= mod;
        if (u < 0)
            u += mod;
        *this *= Mod(u);
        return *this;
    }

    template <typename T>
    Mod operator&(const T x) const
    {
        return Mod(*this) &= x;
    }

    template <typename T>
    Mod operator|(const T x) const
    {
        return Mod(*this) |= x;
    }

    template <typename T>
    Mod operator^(const T x) const
    {
        return Mod(*this) ^= x;
    }

    template <typename T>
    Mod operator<<(const T x) const
    {
        return Mod(*this) <<= x;
    }

    template <typename T>
    Mod operator>>(const T x) const
    {
        return Mod(*this) >>= x;
    }

    template <typename T>
    Mod operator+(const T x) const
    {
        return Mod(*this) += x;
    }

    template <typename T>
    Mod operator-(const T x) const
    {
        return Mod(*this) -= x;
    }

    template <typename T>
    Mod operator*(const T x) const
    {
        return Mod(*this) *= x;
    }

    template <typename T>
    Mod operator/(const T x) const
    {
        return Mod(*this) /= x;
    }

    Mod &operator++()
    {
        *this += 1;
        return *this;
    }

    Mod &operator--()
    {
        this->set_value(--this->value);
        return *this;
    }

    Mod operator++(int)
    {
        Mod ret(*this);
        ++*this;
        return ret;
    }

    Mod operator--(int)
    {
        Mod ret(*this);
        --*this;
        return ret;
    }
};

template <typename T, typename U>
T power(const T x, const U y)
{
    T ret = 1;
    T xx = x;
    U yy = y;
    while (yy > 0)
    {
        if ((yy & 1) > 0)
        {
            ret *= xx;
        }
        xx *= xx;
        yy /= 2;
    }
    return ret;
}
int main()
{
    constexpr long long MOD = 1000000007;
    size_t N;
    cin >> N;
    // vector<long long> A(N);
    // vector<long long> B(N);
    long long A, B;
    map<pair<long long, long long>, pair<long long, long long>> m;
    for (size_t i = 0; i < N; i++)
    {
        cin >> A >> B;
        if (A == 0 && B < 0)
        {
            B = -1;
        }
        else if (A == 0 && B > 0)
        {
            B = 1;
        }
        else if (A < 0 && B == 0)
        {
            A = -1;
        }
        else if (A > 0 && B == 0)
        {
            A = 1;
        }
        else if (A == 0 && B == 0)
        {
        }
        else
        {
            long long tmp = gcd(A, B);
            A /= tmp;
            B /= tmp;
        }

        if ((A > 0 && B >= 0) || (A < 0 && B <= 0))
        {
            m[make_pair(abs(A), abs(B))].first++;
        }
        else
        {
            m[make_pair(abs(B), abs(A))].second++;
        }
    }

    Mod<MOD> ans = 1;
    Mod<MOD> zero = 0;
    for (auto p : m)
    {
        if (p.first.first == 0 && p.first.second == 0)
        {
            zero = p.second.second;
        }
        else
        {
            long long a = p.second.first;
            long long b = p.second.second;
            ans *= power(Mod<MOD>(2), a) + power(Mod<MOD>(2), b) - 1;
        }
    }
    cout << zero + ans - 1 << endl;
}


Measured memory_bytes: 19120