using System;
using System.Collections.Generic;
using static Assistant.Input;
using System.Linq;
using Assistant;

namespace ABC168E_2
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = ReadInt;
            long[] A = new long[N];
            long[] B = new long[N];
            for (int i = 0; i < N; i++)
            {
                A[i] = ReadLong;
                B[i] = ReadLong;
            }

            long mod = 1000000007;

            Dictionary<string, int> P1 = new Dictionary<string, int>();
            Dictionary<string, int> P2 = new Dictionary<string, int>();
            int c00 = 0;
            int ca0 = 0;
            int c0a = 0;
            for (int i = 0; i < N; i++)
            {
                long a = A[i];
                long b = B[i];

                if (a == 0 && b == 0)
                {
                    c00++;
                }
                else if (a == 0) ca0++;
                else if (b == 0) c0a++;
                else
                {
                    long gcd = Gcd(a, b);
                    a /= gcd;
                    b /= gcd;

                    bool minus = false;
                    if (a < 0)
                    {
                        minus = true;
                        a = -a;
                    }
                    if (b < 0)
                    {
                        minus = !minus;
                        b = -b;
                    }

                    string s1 = (minus ? "" : "-") + a.ToString() + "/" + b.ToString();
                    string s2 = (minus ? "-" : "") + b.ToString() + "/" + a.ToString();
                    if (P1.ContainsKey(s1)) P1[s1]++;
                    else if (!P1.ContainsKey(s2))
                    {
                        P1.Add(s1, 1);
                    }
                    if (P2.ContainsKey(s2)) P2[s2]++;
                    else
                    {
                        P2.Add(s2, 1);
                    }
                }
            }

            //Console.WriteLine("P1");
            //foreach (var d in P1)
            //{
            //    Console.WriteLine(d);
            //}
            //Console.WriteLine("P2");
            //foreach (var d in P2)
            //{
            //    Console.WriteLine(d);
            //}

            long sum = 1;
            foreach (var d in P1)
            {
                string s = d.Key;

                long cand = 1;
                if (P2.ContainsKey(s))
                {
                    cand = (ModPow(2, d.Value, mod) + ModPow(2, P2[s], mod) - 1 + mod) % mod;
                }
                else
                {
                    cand = ModPow(2, d.Value, mod);
                }
                sum *= cand;
                sum %= mod;
            }

            sum *= (ModPow(2, ca0, mod) + ModPow(2, c0a, mod) - 1) % mod;
            sum %= mod;

            sum += c00 + mod - 1;
            sum %= mod;

            Console.WriteLine(sum);
        }

        /// <summary>
        /// 最大公約数
        /// </summary>
        /// <param name="a"></param>
        /// <param name="b"></param>
        /// <returns></returns>
        public static long Gcd(long a, long b)
        {
            if (a < b)
                // 引数を入替えて自分を呼び出す
                return Gcd(b, a);
            while (b != 0)
            {
                var remainder = a % b;
                a = b;
                b = remainder;
            }
            return a;
        }
        /// <summary>
        /// a^n (mod p)
        /// nが非常に大きい時に有効
        /// </summary>
        /// <param name="a"></param>
        /// <param name="n"></param>
        /// <param name="mod"></param>
        /// <returns></returns>
        public static long ModPow(long a, long n, long p)
        {
            if (n == 0) return 1;
            if (n == 1) return a % p;
            if (n % 2 == 1) return (a * ModPow(a, n - 1, p)) % p;

            long t = ModPow(a, n / 2, p);
            return (t * t) % p;
        }
    }


}

namespace Assistant
{
    static class Input
    {
        static List<string> line = new List<string>();
        static int index = 0;
        static String ReadNext()
        {
            if (line.Count <= index) line.AddRange(Console.ReadLine().Split());
            return line[index++];
        }
        public static int ReadInt => int.Parse(ReadNext());
        public static long ReadLong => long.Parse(ReadNext());
        public static int[] ReadInts => Console.ReadLine().Split().Select(int.Parse).ToArray();
        public static long[] NextLongs => Console.ReadLine().Split().Select(long.Parse).ToArray();
    }

    static class Debug
    {
        //drawmap
        //drawarray
    }
}


Measured memory_bytes: 111104