Problem: One day two students, Grisha and Diana, found themselves in the university chemistry lab. In the lab the students found n test tubes with mercury numbered from 1 to n and decided to conduct an experiment.

The experiment consists of q steps. On each step, one of the following actions occurs:

  1. Diana pours all the contents from tube number pi and then pours there exactly xi liters of mercury. 
  2. Let's consider all the ways to add vi liters of water into the tubes; for each way let's count the volume of liquid (water and mercury) in the tube with water with maximum amount of liquid; finally let's find the minimum among counted maximums. That is the number the students want to count. At that, the students don't actually pour the mercury. They perform calculations without changing the contents of the tubes. 



Unfortunately, the calculations proved to be too complex and the students asked you to help them. Help them conduct the described experiment.

Input

The first line contains two integers n and q (1 ≤ n, q ≤ 105) — the number of tubes ans the number of experiment steps. The next line contains n space-separated integers: h1, h2, ..., hn (0 ≤ hi ≤ 109), where hi is the volume of mercury in the і-th tube at the beginning of the experiment.

The next q lines contain the game actions in the following format:

  * A line of form "1 pi xi" means an action of the first type (1 ≤ pi ≤ n; 0 ≤ xi ≤ 109). 
  * A line of form "2 vi" means an action of the second type (1 ≤ vi ≤ 1015). 



It is guaranteed that there is at least one action of the second type. It is guaranteed that all numbers that describe the experiment are integers.

Output

For each action of the second type print the calculated value. The answer will be considered correct if its relative or absolute error doesn't exceed 10 - 4.

Examples

Input

3 3
1 2 0
2 2
1 2 1
2 3


Output

1.50000
1.66667


Input

4 5
1 3 0 1
2 3
2 1
1 3 2
2 3
2 4


Output

1.66667
1.00000
2.33333
2.66667

Solution (in JAVA):

Solution:
import java.io.BufferedReader;
import java.io.IOError;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.util.*;

public class CF247_Chem
{
   public static void main(String[] args)
   {
      FastIO scan = new FastIO();
      
      int n = scan.nextInt();
      int q = scan.nextInt();
      
      ArrayList<Integer> values = new ArrayList<Integer>(n);
      //AVLTree tubes = new AVLTree();
      Treap treap = null;
      
      for(int i = 0; i<n; i++)
      {
         int x = scan.nextInt();
         values.add(x);
         //tubes.insert(x);
         treap = insert(treap, x);
      }
      
      for(int i = 0; i<q; i++)
      {
         int m = scan.nextInt();
         if(m==1)
         {
            int p = scan.nextInt()-1;
            int x = scan.nextInt();
            
            int cur = values.get(p);
            values.set(p, x);
            treap = remove(treap, cur);
            treap = insert(treap, x);
         }
         else
         {
            long v = scan.nextLong();
            min = Double.POSITIVE_INFINITY;
            
            findMinAvg(treap, v, 0, 0);
            
            System.out.printf("%.5f\n", min);
            
         }
      }
      
   }
   
   static double min;
   
   public static void findMinAvg(Treap root, long v, int count, long sum)
   {
      if(root == null)
         return;
      int leftCount = root.left == null ? 0 : root.left.count;
      long leftSum = root.left == null ? 0 : root.left.sum;
      int totalCount = count + leftCount + 1;
      long totalSum = sum + leftSum + root.key;
      
      double avg = (double)(totalSum+v)/totalCount;
      
      min = Math.min(min, avg);
      
      if(avg <= root.key)
      {
         findMinAvg(root.left, v, count, sum);
      }
      else
      {
         findMinAvg(root.right, v, totalCount, totalSum);
      }
   }
   
   static Random random = new Random();

	static class Treap {
		int key;
		long prio;
		Treap left;
		Treap right;
		int count;
		long sum;

		Treap(int key) {
			this.key = key;
			prio = random.nextLong();
			count = 1;
			sum = key;
		}

		void update() {
			count = 1 + getCount(left) + getCount(right);
			sum = key + getSum(left) + getSum(right);
		}
	}

	static int getCount(Treap root) {
		return root == null ? 0 : root.count;
	}

	static long getSum(Treap root) {
		return root == null ? 0 : root.sum;
	}

	static class TreapPair {
		Treap left;
		Treap right;

		TreapPair(Treap left, Treap right) {
			this.left = left;
			this.right = right;
		}
	}

	static TreapPair split(Treap root, int minRight) {
		if (root == null)
			return new TreapPair(null, null);
		if (root.key >= minRight) {
			TreapPair leftSplit = split(root.left, minRight);
			root.left = leftSplit.right;
			root.update();
			leftSplit.right = root;
			return leftSplit;
		} else {
			TreapPair rightSplit = split(root.right, minRight);
			root.right = rightSplit.left;
			root.update();
			rightSplit.left = root;
			return rightSplit;
		}
	}

	static Treap merge(Treap left, Treap right) {
		if (left == null)
			return right;
		if (right == null)
			return left;
		if (left.prio > right.prio) {
			left.right = merge(left.right, right);
			left.update();
			return left;
		} else {
			right.left = merge(left, right.left);
			right.update();
			return right;
		}
	}

	static Treap insert(Treap root, int x) {
		return insert(root, new Treap(x));
	}

	static Treap insert(Treap root, Treap node) {
		if (root == null) {
			return node;
		}
		if (node.prio > root.prio) {
			TreapPair split = split(root, node.key);
			node.left = split.left;
			node.right = split.right;
			node.update();
			return node;
		}
		if (node.key < root.key) {
			root.left = insert(root.left, node);
			root.update();
		} else if (node.key > root.key) {
			root.right = insert(root.right, node);
			root.update();
		} else {
			if (random.nextBoolean())
				root.left = insert(root.left, node);
			else
				root.right = insert(root.right, node);
			root.update();
		}
		return root;
	}

	static Treap remove(Treap root, int x) {
		if (root == null) {
			return null;
		}
		if (x < root.key) {
			root.left = remove(root.left, x);
			root.update();
			return root;
		} else if (x > root.key) {
			root.right = remove(root.right, x);
			root.update();
			return root;
		} else {
			return merge(root.left, root.right);
		}
	}

   
   public static class AVLTree   {
      Node root;
   
      public AVLTree()
      {
         root = null;
      }
   
      public void insert(int val)
      {
         Node n = new Node(val);
         if(root!=null)
            root.insert(n);
         else
            root = n;
      }
   
      public void delete(int val)
      {
         if(root!=null)
            root.delete(val);
      }
   
      public Node find(int val)
      {
         return root.find(val);
      }
   
      public class Node
      {
         int value;
         int height;
         long sum;
         int count;
         Node left, right, parent;
      
         public Node(int val)
         {
            value = val;
            height = 0;
            sum = val;
            count = 1;
         }
      
         public int height(Node node)
         {
            if(node!=null)
               return node.height;
            return -1;
         }
      
         public Node find(int val)
         {
            if(val == value)
               return this;  
            Node toSearch = val<=value ? left : right;
            if(toSearch == null)
               return null;
            return toSearch.find(val);
         }
      
         public void insert(Node node)
         {
            sum += node.value;
            count++;
            if(node.value <= value)
            {
               if(left==null)
               {
                  left = node;
                  node.parent = this;
               }
               else
                  left.insert(node);
            }
            else
            {
               if(right==null)
               {
                  right = node;
                  node.parent = this;
               }
               else
                  right.insert(node);
            }
            recalcHeight();
            rebalance();
         }
      
      
         public void delete(int val)
         {
         
            if(val == value)
            {
            
               Node replacement = null;
               Node toDelete = this;
                     
               if(left==null || right == null)
               {
                  if(left==null && right == null)
                  {
                  }
                  else if(left == null)
                  {
                     replacement = right;
                     this.right = null;
                  }
                  else
                  {
                     replacement = left;
                     this.left = null;
                  }
               }
               else
               {
                  toDelete = this.left.maxNode();
                  replacement = toDelete.left;
                  this.value = toDelete.value;
               }
            
               if(toDelete.parent!=null)
               {
                  if(toDelete == toDelete.parent.left)
                     toDelete.parent.left = replacement;
                  else
                     toDelete.parent.right = replacement;
                  
                  if(replacement!=null)
                     replacement.parent = toDelete.parent;
                  toDelete.parent.rebalance();
                  toDelete.parent = null;
                  
                  
                  
               }
               else
               {
                  root = replacement;
                  replacement.parent = null;
               }            
            }
            else
            {
               sum-=val;
               count--;
               if(val <= value)
               {
                  if(left!=null)
                     left.delete(val);
               }
               else
               {
                  if(right!=null)
                     right.delete(val);
               
               }
            }
            this.recalcHeight();
            this.rebalance();
         }
      
         public Node minNode()
         {
            Node temp = this;
            while(temp.left!=null)
               temp = temp.left;
            return temp;
         }
      
         public Node maxNode()
         {
            Node temp = this;
            while(temp.right!=null)
               temp = temp.right;
            return temp;
         }
      
         public void recalcHeight()
         {
            height = 1 + Math.max(height(left), height(right));
         }
      
         public int spread()
         {
            return height(right)-height(left);
         }
      
         public void rebalance()
         {
            int diff = spread();
            if(Math.abs(diff)>1)
            {
            // right heavy
               if(diff>1)
               {
                  if(right.spread()<0)
                  {
                     right.rotateRight();
                  }
                  rotateLeft();
               }
               else
               {
                  if(left.spread()>0)
                  {
                     left.rotateLeft();
                  }    
                  rotateRight();
               }
            }
            if(parent!=null)
               parent.rebalance();
            reSum();
            reCount();
         }
         
         public void reSum()
         {
            long leftSum = 0;
            long rightSum = 0;
            if(left!=null)
               leftSum = left.sum;
            if(right!=null)
               rightSum = right.sum;
            sum = value + leftSum + rightSum;
         }
         
         public void reCount()
         {
            int leftCount = 0;
            int rightCount = 0;
            if(left!=null)
               leftCount = left.count;
            if(right!=null)
               rightCount = right.count;
            count = 1 + leftCount + rightCount;
         }
      
         public void rotateLeft()
         {
            Node tempP = parent;
            Node pivot = right;
         
            right = right.left;
            if(right!=null) right.parent = this;
         
            pivot.left = this;
            pivot.parent = tempP;
            parent = pivot;
         
            if(tempP==null) root = pivot;
            else
            {
               if(this == tempP.left)
                  tempP.left = pivot;
               else
                  tempP.right = pivot;
            }
         
         
            recalcHeight();
            pivot.recalcHeight();
            if(tempP != null) tempP.recalcHeight();
         }
      
         public void rotateRight()
         {
            Node tempP = parent;
            Node pivot = left;
         
            left = pivot.right;
            if(left!=null) left.parent = this;
         
            pivot.right = this;
            pivot.parent = tempP;
            parent = pivot;
         
            if(tempP==null) root = pivot;
            else
            {
               if(this.equals(tempP.left))
                  tempP.left = pivot;
               else
                  tempP.right = pivot;
            }
         
            recalcHeight();
            pivot.recalcHeight();
            if(tempP != null) tempP.recalcHeight();  
         }
      }
   }
   
   public static class FastIO {
      BufferedReader br;
      StringTokenizer st;
      PrintWriter out;
   
      public FastIO(InputStream in, OutputStream o) {
         br = new BufferedReader(new InputStreamReader(in));
         out = new PrintWriter(new OutputStreamWriter(o));
         eat("");
      }
   
      public FastIO() {
         br = new BufferedReader(new InputStreamReader(System.in));
         out = new PrintWriter(new OutputStreamWriter(System.out));
         eat("");
      }
   
      public void eat(String s) {
         st = new StringTokenizer(s);
      }
   
      public String nextLine() {
         try {
            return br.readLine();
         } 
         catch (IOException e) {
            throw new IOError(e);
         }
      }
   
      public boolean hasNext() {
         while (!st.hasMoreTokens()) {
            String s = nextLine();
            if (s == null)
               return false;
            eat(s);
         }
         return true;
      }
   
      public String next() {
         hasNext();
         return st.nextToken();
      }
   
      public int nextInt() {
         return Integer.parseInt(next());
      }
   
      public long nextLong() {
         return Long.parseLong(next());
      }
   
      public double nextDouble() {
         return Double.parseDouble(next());
      }
   
      public void print(String ans) {
         out.print(ans);
         out.flush();
      }
   
      public void println(String ans) {
         out.println(ans);
         out.flush();
      }
   
      public void close() {
         out.close();
      }
   
   }

}