#include<bits/stdc++.h>
using namespace std;
const int MAX_N = 2e5 + 5;
pair<int, int> pts[MAX_N];
long long _2pow[MAX_N];
const long long mod = 1e9 + 7;
int n;

struct pair_hash {
    inline std::size_t operator()(const std::pair<int,int> & v) const {
        return v.first*31+v.second;
    }
};

void solve(){
    int i = 0;
    _2pow[0] = 1;
    for(i = 1; i < MAX_N; i++){
        _2pow[i] = _2pow[i - 1] * 2;
        _2pow[i] %= mod;
    }
    map<pair<int, int>, int> mp;
    std::unordered_set< std::pair<int, int>,  pair_hash> s;
    for(i = 0; i < n; i++){
        int gcd = __gcd(pts[i].first, pts[i].second);
        pts[i].first /= gcd;
        pts[i].second /= gcd;
        if(pts[i].second < 0) {
            pts[i].first *= -1;
            pts[i].second *= -1;
        }
        mp[make_pair(pts[i].first, pts[i].second)]++;
        s.insert(make_pair(pts[i].first, pts[i].second));
    }
    long long ans = 1;
    long long to_sub = 1;
    for(const auto &p: mp){
        //cout << p.first.first << " " << p.first.second << " " << mp[make_pair(p.first.first, p.first.second)] << "\n";
        pair<int, int> pp = make_pair(-p.first.second, p.first.first);
        if (pp.second < 0) {
            pp.first *= -1;
            pp.second *= -1;
        }
        if(mp.find(pp) != mp.end()) {
            //cout << "hola";
            ans *= (_2pow[mp[make_pair(p.first.first, p.first.second)]] + _2pow[mp[pp]] - 1);
            mp.erase(pp);
            //to_sub *= 2;
            //to_sub %= mod;
        }
        else
            ans *= _2pow[mp[make_pair(p.first.first, p.first.second)]];
        ans %= mod;
    }
    ans -= 1;
    ans += mod;
    ans %= mod;
    cout << ans;
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> n;
    int i = 0;
    for(i = 0; i < n; i++){
        int x, y;
        cin >> x >> y;
        pts[i] = make_pair(x, y);
    }
    solve();
    return 0;
}