#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <numeric>
#include <iomanip>

#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 998244353; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;
struct INIT { INIT(){
  cin.tie(0); ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
}}INIT;


signed main() {
  int N; 
  cin >> N;

  map<pair<int, int>, pair<int, int>> m;

  int zero = 0;
  REP(i, N){
    int x, y;
    cin >> x >> y;
    if(x == 0 && y == 0){
      zero++;
      continue;
    }

    if(y < 0 || (y == 0 && x < 0)){
      x *= -1; y *= -1;
    }
    if(x == 0){
      m[{0, 1}].first++;
    }else if(y == 0){
      m[{0, 1}].second++;
    }else{
      int g = gcd(x, y);
      x /= g; y /= g;
      if(x > 0 && y > 0) m[{x, y}].first++;
      else{
        int tmp = x;
        x = y;
        y = -tmp;
        m[{x, y}].second++;
      }
    }
  }

  auto f = [&](pair<int, int> p){
    int a = 0, b = 0;
    if(p.first != 0) a = (int)pow(2, p.first)-1;
    if(p.second != 0) b = (int)pow(2, p.second)-1;
    return a+b+1;
  };

  int ans = 1;
  for(auto p : m){
    (ans *= f(p.second)) %= MOD;
  }

  cout << ((ans+zero-1)%MOD+MOD)%MOD << "\n";

  return 0;
}
