#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

#define MOD (int)1e9+7
#define rep(i,a,b) for(int i=a;i<b;++i)
#define rrep(i,a,b) for(int i=a;i>=b;--i)
#define vi vector<int>
#define vl vector<ll>
#define ld long double
#define vvi vector<vector<int>>
#define vvl vector<vector<long long>>
#define pii pair<int,int>
#define pll pair<long,long>
#define vpii vector<pii>
#define vpll vector<pll>
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define PI 3.1415926535897932384626433832795
#define fix(f,n) fixed<<setprecision(n)<<f
#define all(x) x.begin(),x.end()

ll powM(ll a,ll b,ll m )
{ 
  a%=m;
  ll ans=1;
  while(b>0)
  {
    if(b&1)ans=ans*a%m;
    a=a*a%m;
    b>>=1;
  }

return ans;
}

pll norm(ll a,ll b)
{
  if(a==0&&b==0)return mp(0LL,0LL);

  if(a==0)return mp(0LL,1LL);

  if(b==0)return mp(-1LL,0LL);

  ll x=__gcd(abs(a),abs(b));
  a/=x;
  b/=x;

  if(a<0)
  {
    return mp(-a,-b);
  }
 return mp(a,b);


}



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

ll n,a,b,x1=0,x2=0;
cin>>n;
ll m=1e9+7;
ll zero_cnt=0,ans=1;
//cout<<ans<<"\n";
map<pair<ll,ll>,ll>m1;

for(int i=1;i<=n;i++)
{
  cin>>a>>b;
 // if(a==0&&b==0)extra++;

 

  if(a==0&&b==0)zero_cnt++;
  else if(a==0)x1++;
  else if(b==0)x2++;

  else 
    {
       pll p =norm(a,b);

  //cout<<p.ff<<" "<<p.ss<<"\n";

  ll a1=p.ff,b1=p.ss;
      m1[{a1,b1}]++;
    }
  //m1[{-b1,a1}]++;
  //m2[{-b1,a1}]++;
}

ll del=1,total=0,temp;
for(auto x:m1)
{
  ll a1=x.ff.ff;
  ll b1=x.ff.ss;
  ll cnt1=x.ss;
ll d;
  if(b1<0)d=1;
  else d=-1;

//if(!cnt1)continue;
  //if(b1<0)cnt2=m1[{}]


   ll cnt2=m1[{abs(b1),d*a1}];

  //if(!cnt2)total+=cnt1;
  //if(!cnt2)ans*=powM(2,cnt1,m);

//cout<<cnt1<<" "<<cnt2<<"\n";
  ans*=(powM(2,cnt1,m)+powM(2,cnt2,m)-1)%m;
  
  ans%=m;

  //(temp*=powM(2,n-cnt1-cnt2-1,m))%=m;

  //ans-=temp;
 // del=del*temp%m;
//m1.erase({a1,b1});
m1.erase({abs(b1),d*a1});
  //m1[{-b1,a1}]=0;
}
//(del+=m-1)%=m;
 ans*=(powM(2,x1,m)+powM(2,x2,m)-1)%m;
ans+=zero_cnt-1;

cout<<ans<<"\n";



return 0;

}
