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

namespace kval25
{
    class Program
    {
        static void Main(string[] args)
        {
            var line = Console.ReadLine();
            var data = line.Split(' ');
            int w = int.Parse(data[0]);
            int h = int.Parse(data[1]);
            int r = int.Parse(data[2]);
            int q = int.Parse(data[3]);

            double[] ymin = new double[w];
            double[] ymax = new double[w];
            for (int i = 0; i < w; i++)
            {
                ymin[i] = 0;
                ymax[i] = h;
            }

            string[] a = new string[q];
            for (int i = 0; i < q; i++)
            {
                line = Console.ReadLine();
                a[i] = line;
            }

            for (int i = 0; i < q; i++)
            {
                data = a[i].Split(' ');
                if (int.Parse(data[0]) == 2)
                    Console.WriteLine(ymax[int.Parse(data[1])] - ymin[int.Parse(data[1])]);
                else
                {
                    int ox = int.Parse(data[1]);
                    int oy = int.Parse(data[2]);

                    int j = ox - r + 1;
                    while (j < 0)
                        j++;
                    for (int xkoord = j; xkoord < ox + r - 1; xkoord++)
                    {
                        double y = oy - Math.Sqrt(r * r - (xkoord - ox) * (xkoord - ox));
                        if (y < 0)
                            ymax[xkoord] = 0;
                        else
                        {
                            if (y < ymax[xkoord])
                                ymax[xkoord] = y;
                        }
                    }
                }
            }
        }
    }
}