Budget Analysis You are an analyst, studying the relationship between advertisement budget spending (denoted by ) and sales (denoted by ) over the period of months. More specifically, for every month of time from 1 to n you have the value of spending and sales . To quantify the relationship you are using linear regression with regularisation, which means that you are modelling as , where and are real numbers minimising the penalty function: center center (Note: this is the standard penalty function for L2 regularised linear regression.) For the report requested by your manager, you need to make several predictions. More specifically, you have a list of prediction queries, each described by four numbers - , , and . To process such a query you need to perform the following steps: itemize take the spending and sales values for the months from to inclusive; find the coefficients and , which minimise the penalty function for the given regularisation coefficient ; plug the into the resulting model and compute the prediction. itemize You are given the ads spending and sales data, and the prediction queries descriptions. You are to process the queries and output the predictions. Input First line of the input file contains an integer number () denoting the number of months in the period you are studying. Each of the following lines describes one month and contains two non-negative real numbers and not exceeding 10. They denote the budget spending and sales in the corresponding month. The following line contains an integer number () denoting the number of predictions to be made. Each of the following lines contains four numbers: , , and (, ). First two of them are integers, the remaining are real. Output For each prediction query output one real number on a separate line - the predicted sales assuming the advertisement spending is and the linear model has been fitted on months from to using L2-regularisation with regularisation coefficient. The output must be accurate to an absolute or relative error of at most .