using System;

namespace ConsoleApp5
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] first = Console.ReadLine().Split(' ');
            int w = int.Parse(first[0]);
            int h = int.Parse(first[1]);
            int r = int.Parse(first[2]);
            int q = int.Parse(first[3]);
            int[,] naredbe = new int[q, 3];
            for (int i = 0; i < q; i++)
            {
                string[] tempD = Console.ReadLine().Split(' ');
                naredbe[i, 0] = int.Parse(tempD[0]);
                naredbe[i, 1] = int.Parse(tempD[1]);
                if (tempD.Length > 2)
                    naredbe[i, 2] = int.Parse(tempD[2]);
            }
            double[,] tacke = new double[w + 1, 2];
            for (int i = 0; i <= w; i++)
            {
                tacke[i, 0] = i;
                tacke[i, 1] = h;
            }

            for (int i = 0; i < q; i++)
            {
                if (naredbe[i, 0] == 1)
                {
                    double[,] krug = func(naredbe[i, 1], naredbe[i, 2], r);
                    for (int j = 0; j < r * 2; j++)
                    {
                        for (int k = 0; k < w + 1; k++)
                        {
                            if (krug[j, 0] == tacke[k, 0])
                                if (krug[j, 1] < tacke[k, 1])
                                    tacke[k, 1] = krug[j, 1];
                        }
                    }
                }
                else
                {
                    Console.WriteLine(tacke[naredbe[i, 1], 1]);
                }
            }
        }
        public static double[,] func(int x, int y, int r)
        {
            double[,] tacke = new double[r * 2, 2];
            for (int i = 0; i < r * 2; i++)
            {
                double tx = x - r + i;
                double temp = x - tx;
                double ty = y - Math.Sqrt(Math.Abs(Math.Pow(r, 2) - Math.Pow(temp, 2)));
                tacke[i, 0] = tx;
                tacke[i, 1] = ty;
            }
            return tacke;
        }
    }
}