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

template<class T> struct rge { T b, e; };
template<class T> rge<T> range(T i, T j) { return rge<T>{i, j}; }
struct debug {
#ifdef LOCAL
    ~debug(){cerr<<endl;}
    template<class T> debug& operator<<(T x){cerr<<boolalpha<<x; return *this;}
    template<class B, class C> debug& operator<<(pair<B, C> x){return *this<<"("<<x.first<<", "<<x.second<<")";}
    template<class T> debug& operator<<(rge<T> x){*this<<"[";for(auto it=x.b;it!=x.e;it++){*this<<", "+2*(it==x.b)<<*it;}return *this<<"]";}
    template<class T> debug& operator<<(vector<T> x){ return *this<<range(x.begin(),x.end());}
#else
    template<class T> debug& operator <<(const T&){return *this;}
#endif
};
#define nav(...) << "[ " << #__VA_ARGS__ ": " << (__VA_ARGS__) << " ] "
using ll = long long;

#define forn(i, n) for(int i = 0; i < int(n); i++)
#define ford(i, n) for(int i = n-1; i >= 0; i--) 

template<typename T> 
void min_self(T& a, T b) { 
    a = min(a, b); 
}
template<typename T>
void max_self(T& a, T b) { 
    a = max(a, b); 
}

const int mod = 1e9+7;

int add(int a, int b) {
    a += b;
    while(a >= mod) a -= mod;
    while(a < 0) a += mod;
    return a;
}
void add_self(int& a, int b) {
    a = add(a, b);
}
int mul(int a, int b) {
    return 1LL * a * b % mod;
}
int mpow(int a, int n) {
    if(n == 0) {
        return 1;
    }
    int x = mpow(a, n/2);
    x = mul(x, x);
    if(n % 2 == 1) {
        x = mul(x, a);
    }
    return x;
}

struct V {
    ll x, y;
    
    V& normalize() {
        if(x < 0) {
            x *= -1, y *= -1;
        }
        if(x == 0 && y) y = 1;
        if(y == 0 && x) x = 1;
        else if(x && y) {
            ll g = gcd(llabs(x), llabs(y));
            x /= g, y /= g;
        }
        return *this;
    }
    
    V perp() const {
        V p{-y, x};
        return p.normalize();
    }
    
    bool operator < (const V& rhs) const {
        return tie(x, y) < tie(rhs.x, rhs.y);
    }
};

ostream& operator <<(ostream& out, V v) {
    return out << "(" << v.x << ", " << v.y << ")";
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    int n;
    cin >> n;
    map<V, int> freq;
    for(int i = 0; i < n; i++) {
        ll x, y;
        cin >> x >> y;
        V v{x, y};
        if(x == 0 && y == 0) {
            continue;
        }
        v.normalize();
        ++freq[v];
    }
    
    if(freq.empty()) {
        cout << "1\n";
        exit(0);
    }
    
    int ans = 1;
    for(auto pp : freq) {
        V v = pp.first;
        int cnt1 = pp.second;
        V u = v.perp();
        if(freq.count(u) && !(v < u)) {
            continue;
        }
        int cnt2 = freq.count(u) ? freq[u] : 0;
        debug() nav(v) nav(u) nav(cnt1) nav(cnt2);
        ans = mul(ans, add(mpow(2, cnt1), add(mpow(2, cnt2), -1)));
    }
    ans = add(ans, -1);
    
    cout << ans << endl;
}













// Don't worry, you're getting better

// Read statement carefully
// Solve on paper first!
// Make your infinity big enough
// Overflows (long long)

// Author: blondie
