/*input
10
3 2
3 2
-1 1
2 -1
-3 -9
-8 12
7 7
8 1
8 2
8 4
*/

#include <bits/stdc++.h>
using namespace std;
 
 
 
#define int long long int
#define rep(i,n) \
    for(int i = 0; i < n; i++)
#define rep2(i, a, b) \
    for(int i = a; i < b; i++)
#define all(c) \
    c.begin(), c.end()
#define init(arr, num) \
    memset(arr, num, sizeof(arr))
#define fast\
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define inputFile \
    freopen("input.txt", "r", stdin); 
#define outputFile \
    freopen("output.txt", "w", stdout);
#define modM 1000000007
#define PI 3.1415926535897932
 
#ifdef Voneone
#define TRACE
#endif
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
    cout << name << " : " << arg1 << std::endl;
 
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
    const char* comma = strchr(names + 1, ','); 
    cout.write(names, comma - names) << " : " << arg1 << " | "; 
    __f(comma + 1, args...);
}
#else
#define trace(...)
#endif
 
 
typedef long long ll;
typedef vector<int> vi;
typedef vector< vi > vvi;
typedef pair< int, int > ii;
typedef unordered_set<int> usi;
 

ii reduce(int x, int y){
    if(x == 0) return {0,1};
    if(y == 0) return {1,0};
    if(x < 0 && y < 0)
        x = -x, y = -y;
    if(x < 0)
        x = -x, y = -y;

    int g = __gcd(abs(x), abs(y));
    return {x/g, y/g};
}

ii cmplnt(ii f){
    ii r = {f.second, f.first};
    if(r.first < 0) r.first = -r.first;
    else r.second = -r.second;
    return r;
}


int modpower(int x, unsigned int y, int p) 
{ 
    int res = 1;      // Initialize result 
  
    x = x % p;  // Update x if it is more than or  
                // equal to p 
  
    while (y > 0) 
    { 
        // If y is odd, multiply x with result 
        if (y & 1) 
            res = (res*x) % p; 
  
        // y must be even now 
        y = y>>1; // y = y/2 
        x = (x*x) % p;   
    } 
    return res; 
} 
 
void solve() 
{ 
 

    int n;
    cin >> n;

    map<ii, int> freq;

    rep(i, n){
        int a, b;
        cin >> a >> b;

        auto r = reduce(a, b);
        freq[r]++;

    }

    int ans = 1;
    set<ii> vis;

    for(auto x : freq){

        if(vis.count(x.first)) continue;
        auto cm = cmplnt(x.first);

        int freq_n = x.second;
        int freq_c = freq[cm];
        int tmp;
        if(freq_n)
        tmp = modpower(2, freq_n, modM);
        if(freq_c)
        tmp += modpower(2, freq_c, modM);
        trace(freq_n, freq_c);
        if(freq_n > 0 && freq_c > 0)
            tmp -= 1;
        tmp %= modM;
        ans *= tmp;
        ans %= modM;

        vis.insert(x.first);
        vis.insert(cm);

        trace(x.first.first, x.first.second, cm.first, cm.second);


    }

    

    cout << ans-1;


 
} 
 
 
 
 
signed main()
{
 
    
    #ifdef _DEBUG
    inputFile;
    #endif
    #ifndef __CINP
    fast;
    #endif
 
 
    int T = 1;
    // cin >> T;
    while(T--){
        solve();
        cout << endl;
        
        
 
    }
    
    
    return 0;
 
}
 

