#define _USE_MATH_DEFINES
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <clocale>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

const int MOD = 1'000'000'007; 
const int INF = 1'000'000'000; //1e9
const int NIL = -1;
const long long LINF = 1'000'000'000'000'000'000; // 1e18
const long double EPS = 1E-10;

template<class T, class S> inline bool chmax(T &a, const S &b){
    if(a < b){
        a = b; return true;
    }
    return false;
}
template<class T, class S> inline bool chmin(T &a, const S &b){
    if(b < a){
        a = b; return true;
    }
    return false;
}



long long power(long long a, unsigned long long b, long long m){
    long long ret(1);
    while(b){
        if(b & 1) ret = (ret * a) % m;
        a = (a * a) % m;
        b /= 2;
        if(ret < 0) ret += m;
        if(a < 0) a += m;
    }
    return ret;
}


int main(){
    int N; std::cin >> N;
    std::map<std::pair<long long, long long>, int> mp;
    {
        long long A, B, g;
        for(int i(0); i < N; ++i){
            std::cin >> A >> B;
            g = std::gcd(A, B);
            if(!g)continue;
            A /= g; B /= g;
            if(A < 0){
                A *= -1; B *= -1;
            }
            ++mp[{A, B}];
        }
    }
    std::map<std::pair<long long, long long>, bool> used;
    long long ans(1);
    for(auto itr(std::begin(mp)); itr != std::end(mp); ++itr){
        long long a(itr->first.first), b(itr->first.second);
        if(used[{a, b}]) continue;
        long long c(power(2, itr->second, MOD) - 1);
        long long d(0);
        int al(b), bt(-a);
        if(al < 0){
            al *= -1; bt *= -1; 
        }
        if(mp.find({al, bt}) != mp.end()){
            used[{al, bt}] = true;
            d = power(2, mp[{al, bt}], MOD) - 1;
        }
        ans = (ans * (c + d + 1)) % MOD;
        if(ans < 0) ans += MOD;
    }
    --ans;
    if(ans < 0) ans += MOD;
    std::cout << ans << std::endl;
    return 0;
}
