You have got a new job, and it's very interesting, you are a ship captain. Your first task is to move your ship from one point to another point, and for sure you want to move it at the minimum cost.

And it's well known that the shortest distance between any 2 points is the length of the line segment between these 2 points. But unfortunately there is an island in the sea, so sometimes you won't be able to move your ship in the line segment between the 2 points.

You can only move to safe points. A point is called safe if it's on the line segment between the start and end points, or if it's on the island's edge.

But you are too lucky, you have got some clever and strong workers and they can help you in your trip, they can help you move the ship in the sea and they will take 1 Egyptian pound for each moving unit in the sea, and they can carry the ship (yes, they are very strong) and walk on the island and they will take 2 Egyptian pounds for each moving unit in the island. The money which you will give to them will be divided between all workers, so the number of workers does not matter here.

You can move your ship on the island edge, and it will be considered moving in the sea.

Now you have a sea map, and you have to decide what is the minimum cost for your trip.

Your starting point is (xStart, yStart), and the end point is (xEnd, yEnd), both points will be different.

The island will be a convex polygon and there will be no more than 2 polygon points on the same line, also the starting and the end points won't be inside or on the boundary of the island. The points for the polygon will be given in the anti-clockwise order.

Input

The first line contains 4 integers, xStart, yStart, xEnd and yEnd ( - 100 ≤ xStart, yStart, xEnd, yEnd ≤ 100). The second line contains an integer n, which is the number of points in the polygon (3 ≤ n ≤ 30), followed by a line containing n pairs of integers x and y, which are the coordinates of the points ( - 100 ≤ x, y ≤ 100), the polygon points will be distinct.

Output

Print one line which contains the minimum possible cost. The absolute or relative error in the answer should not exceed 10 - 6.

Examples

Input

1 7 6 7
4
4 2 4 12 3 12 3 2


Output

6.000000000


Input

-1 0 2 0
4
0 0 1 0 1 1 0 1


Output

3.000000000
#include <bits/stdc++.h>
using namespace std;
long long read() {
  long long ret = 0, f = 1;
  char x = getchar();
  while (!(x >= '0' && x <= '9')) {
    if (x == '-') f = -1;
    x = getchar();
  }
  while (x >= '0' && x <= '9') ret = ret * 10 + x - '0', x = getchar();
  return ret * f;
}
char get_char() {
  char x = getchar();
  while (!((x >= 'a' && x <= 'z') || (x >= 'A' && x <= 'Z'))) x = getchar();
  return x;
}
const double eps = 1e-10;
int dcmp(double n) {
  if (fabs(n) < eps)
    return 0;
  else if (n < 0)
    return -1;
  else
    return 1;
}
struct point {
  double x, y;
  point() {}
  point(double x, double y) : x(x), y(y) {}
  bool operator<(const point& p) const {
    if (dcmp(x - p.x) != 0) return x < p.x;
    if (dcmp(y - p.y) != 0) return y < p.y;
    return false;
  }
  bool operator==(const point& p) const {
    return dcmp(x - p.x) == 0 && dcmp(y - p.y) == 0;
  }
  void read() { scanf("%lf %lf", &x, &y); }
  void print() const { printf("x:%.3lf y:%.3lf\n", x, y); }
  double len() const { return sqrt(x * x + y * y); }
};
point operator-(const point& a, const point& b) {
  return point(a.x - b.x, a.y - b.y);
}
point operator+(const point& a, const point& b) {
  return point(a.x + b.x, a.y + b.y);
}
point operator*(double num, const point& a) {
  return point(a.x * num, a.y * num);
}
double det(point a, point b) { return a.x * b.y - b.x * a.y; }
double det(point a, point b, point o) { return det(a - o, b - o); }
double dot(point a, point b) { return a.x * b.x + a.y * b.y; }
double ang(point a, point b) {
  double cosx = dot(a, b) / (a.len() * b.len());
  return acos(cosx);
}
point rotate(point p, double d) {
  double tx = cos(d) * p.x - sin(d) * p.y;
  double ty = sin(d) * p.x + cos(d) * p.y;
  return point(tx, ty);
}
bool on_line(point p, point a, point b) {
  if (b < a) swap(a, b);
  if (dcmp(p.x - a.x) < 0 || dcmp(b.x - p.x) > 0) return false;
  int m = dcmp(det(b - a, p - a));
  return m == 0;
}
bool is_inter(point a1, point a2, point b1, point b2) {
  int m1 = dcmp(det(a2, b1, a1));
  int m2 = dcmp(det(a2, b2, a1));
  int m3 = dcmp(det(b2, a1, b1));
  int m4 = dcmp(det(b2, a2, b1));
  return m1 != m2 && m3 != m4;
}
point inter_point(point a1, point a2, point b1, point b2) {
  double t = det(a1, b2, b1) / det(b2 - b1, a2 - a1);
  return (a1 + t * (a2 - a1));
}
const int L_N = 30 + 10;
const double INF = 1e9;
point S, E;
vector<point> PS;
set<point> INT_SET;
int N;
double dis[L_N][L_N];
bool get_inter() {
  for (int i = 0; i < PS.size(); i++) {
    int nxt = (i + 1) % PS.size();
    if (is_inter(S, E, PS[i], PS[nxt])) {
      point t = inter_point(S, E, PS[i], PS[nxt]);
      if (INT_SET.count(t)) continue;
      INT_SET.insert(t);
      PS.insert(PS.begin() + i + 1, t);
      return true;
    }
  }
  return false;
}
double get_ans_int() {
  point p1, p2;
  int sid = 0, eid = 0;
  set<point>::iterator it = INT_SET.begin();
  p1 = *it;
  it++;
  p2 = *it;
  for (int i = (0); i <= ((int)PS.size() - 1); i++) {
    if (PS[i] == p1)
      sid = i;
    else if (PS[i] == p2)
      eid = i;
  }
  double ans = 2 * (p1 - p2).len();
  ans = min(ans, dis[sid][eid]);
  ans += min((S - p1).len(), (S - p2).len());
  ans += min((E - p1).len(), (E - p2).len());
  return ans;
}
int main() {
  for (int i = (0); i <= (L_N - 1); i++)
    for (int j = (0); j <= (L_N - 1); j++)
      if (i != j) dis[i][j] = INF;
  S.read(), E.read();
  N = read();
  PS.resize(N);
  for (int i = (0); i <= (N - 1); i++) PS[i].read();
  while (get_inter())
    ;
  for (int i = (0); i <= ((int)PS.size() - 1); i++) {
    int nxt = (i + 1) % PS.size();
    dis[i][nxt] = dis[nxt][i] = (PS[i] - PS[nxt]).len();
  }
  for (int k = (0); k <= (N + 2); k++)
    for (int i = (0); i <= (N + 2); i++)
      for (int j = (0); j <= (N + 2); j++) {
        if (dcmp(dis[i][k] + dis[k][j] - dis[i][j]) < 0)
          dis[i][j] = dis[i][k] + dis[k][j];
      }
  double ans = 0;
  if (INT_SET.size() < 2)
    ans = (S - E).len();
  else
    ans = get_ans_int();
  printf("%.10lf\n", ans);
}
