using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ZadatakGric
{
    class Program
    {
        static void Main(string[] args)
        {
            //W > x
            //H > y 
            //R > radius vilice
            //Q > Broj dogadjaja

            string[] WHRQ = Console.ReadLine().Split();
            double W = double.Parse(WHRQ[0]);
            double H = double.Parse(WHRQ[1]);
            double R = double.Parse(WHRQ[2]);
            int Q = int.Parse(WHRQ[3]);

            int ProveraX, xi=0, yi=0;
            double a, b;

            double[] resenje = null;
            resenje = new double[Q];

            int provera = 0;

            for (int i = 0; i < Q; i++)
            {
                string[] unos = Console.ReadLine().Split();
                if (unos[0] == "1")
                {
                    xi = int.Parse(unos[1]);
                    yi = int.Parse(unos[2]);
                }
                else if (unos[0] == "2")
                {
                    if (xi == 0 && yi == 0)
                    {
                        resenje[provera] = H;
                    }
                    else
                    {
                        ProveraX = int.Parse(unos[1]);
                        a = xi - ProveraX;

                        a = (R * R) - (a * a);

                        a = Math.Sqrt(a);

                        a = yi - a;

                        resenje[provera] = a;
                    }
                    provera++;
                }
            }

            for (int i = 0; i < provera; i++)
            {
                Console.WriteLine(resenje[i]);
            }

            Console.ReadLine();
        }
    }
}