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

namespace Gric
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split();
            int W = int.Parse(str[0]);
            int H = int.Parse(str[1]);
            int R = int.Parse(str[2]);
            int Q = int.Parse(str[3]);
            string konacno = "";
            int br = 0;
            int[] b = new int[Q];
            double[] a = new double[W];
            for (int i = 0; i < W; i++)
            {
                a[i] = H;
            }
            for (int i = 0; i < Q; i++)
            { 
                str = Console.ReadLine().Split();
                int s = int.Parse(str[0]);
                int x = int.Parse(str[1]);
                if (s == 2)
                {
                    
                    konacno += (a[x].ToString("n12")) + " \n";
                    br++;
                }
                else //jede
                {
                    int y = int.Parse(str[2]);
                    int l = x - R;
                    int d = x + R;
                    if(y!=H+R)
                    {
                        for (int j = 0; j < W; j++)
                        {
                            if(j>l && j<d)
                            {
                                if (x == j) a[j] = y - R;
                                else
                                {
                                    int pom = (R * R)-1;
                                    a[j] = y - Math.Sqrt(pom);
                                }
                            }
                        }
                    }
                }
            }
            Console.Write(konacno);
        }
    }
}