A crow lives on the two dimensional plane. Today it flew around all day again, looking for food and for anything shiny.
The part of the plane with y<0 is ground, so the crow cannot go there. There is also one mountain, and the crow cannot go inside it either. The mountain is described by N vertices P1(x1,y1) through PN(xN,yN). The values xi are given in increasing order, every yi satisfies yi≥0, and y1=yN=0. Joining P1 through PN in order and then joining PN back to P1 gives the boundary of the mountain. The crow may travel along the edges of the mountain, but it cannot enter the interior.
The crow made M−1 moves today. It started at Q1(X1,Y1), went to Q2(X2,Y2) next, and so on until it visited QM(XM,YM) and ended the day. The crow is clever, so each move from Qi to Qi+1 took a shortest path that passes through neither the interior of the ground nor the interior of the mountain. Write a program that computes the total distance the crow travelled today.
The first line contains N (3≤N≤1000).
The i-th of the next N lines contains xi and yi (−104≤xi≤104, 0≤yi≤104) separated by one space. xi<xi+1 holds for every i with 1≤i<N, and y1=yN=0.
The next line contains M (2≤M≤1000).
The i-th of the next M lines contains Xi and Yi (−104≤Xi≤104, 0≤Yi≤104) separated by one space. No (Xi,Yi) lies inside the mountain. It may lie on the boundary.
Print the total distance the crow travelled, rounded to six digits after the decimal point, on one line. Always print all six digits.
The terrain of the first example is shown below. Green is the mountain and brown is the ground. The crow can move through the light blue area and along the edges of the mountain and the ground.

The next two pictures show the two moves of the crow. The first move has length 52 and the second has length 5+5, so the two together are about 14.307136.

