Problem: 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

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
using namespace rel_ops;
const double PI = acos((double)-1);
int ts, ts2, ts3, ts4;
double sqr(double x) { return x * x; }
int n, m;
class point {
 public:
  double x, y;
  point() { x = y = 0; }
  point(double a, double b) { x = a, y = b; }
  inline friend point operator+(const point &A, const point &B) {
    return point(A.x + B.x, A.y + B.y);
  }
  inline friend point operator-(const point &A, const point &B) {
    return point(A.x - B.x, A.y - B.y);
  }
  inline friend point operator*(const point &A, double p) {
    return point(A.x * p, A.y * p);
  }
  inline friend point operator/(const point &A, double p) {
    return point(A.x / p, A.y / p);
  }
  inline friend void operator+=(point &A, const point &B) { A = A + B; }
  inline friend void operator-=(point &A, const point &B) { A = A - B; }
  inline friend void operator*=(point &A, double B) { A = A * B; }
  inline friend void operator/=(point &A, double B) { A = A / B; }
  inline friend bool operator<(const point &A, const point &B) {
    return A.x < B.x - 1E-10 || fabs(A.x - B.x) < 1E-10 && A.y + 1E-10 < B.y;
  }
  inline friend bool operator==(const point &A, const point &B) {
    return !(A < B || B < A);
  }
  inline friend bool operator>(const point &A, const point &B) { return B < A; }
};
class XL {
 public:
  point a, b;
  XL() {}
  XL(point x, point y) {
    a = x;
    b = y;
  }
  XL(double t1, double t2, double t3, double t4) {
    a.x = t1;
    a.y = t2;
    b.x = t3;
    b.y = t4;
  }
};
inline double gag(double x) {
  if (x < -PI - 1E-10) return gag(x + 2 * PI);
  if (x > PI - 1E-10) return gag(x - 2 * PI);
  return x;
}
inline double gag2(double x) {
  if (x < -1E-10) return gag2(x + 2 * PI);
  if (x > 2 * PI - 1E-10) return gag2(x - 2 * PI);
  return x;
}
inline double chaji(const point &A, const point &B) {
  return A.x * B.y - B.x * A.y;
}
inline double dianji(const point &A, const point &B) {
  return A.x * B.x + A.y * B.y;
}
inline double dis(const point &A, const point &B) {
  return sqrt(sqr(A.x - B.x) + sqr(A.y - B.y));
}
inline double dis(const XL &A) { return dis(A.a, A.b); }
inline double dis(const point &A) { return sqrt(sqr(A.x) + sqr(A.y)); }
inline double atan2(const point &A) { return gag(atan2(A.y, A.x)); }
inline point shengcheng(double JD, double CD = 1.0) {
  return point(cos(JD) * CD, sin(JD) * CD);
}
inline short sgn(double x) {
  if (fabs(x) < 1E-10)
    return 0;
  else if (x < 0)
    return -1;
  else
    return 1;
}
point poo = point(200000000000000000ll, 200000000000000000ll);
point cross(XL a, XL b) {
  double u1 = chaji(b.a - a.a, b.b - a.a), u2 = chaji(b.b - a.b, b.a - a.b);
  if (u1 + u2 == 0) return poo;
  return a.a + (a.b - a.a) * (u1 / (u1 + u2));
}
int online(point x, XL a) {
  return dis(x - a.b) + dis(a.a - x) <= dis(a) + 1E-10;
}
int iscross(XL a, XL b) {
  point pp = cross(a, b);
  return pp != poo && online(pp, a) && online(pp, b) && dis(pp - a.a) > 1E-10;
}
long long gcd(long long x, long long y) {
  long long t;
  for (; y != 0;) {
    t = x % y;
    x = y;
    y = t;
  }
  return x;
}
point st, en, a[1005];
void input(point &x) { cin >> x.x >> x.y; }
point cr[10];
int cr_, cr1[10];
int main() {
  int i, j, k, l, t1, t2, t3, t4, t5, t6, t7, t8, t9, t, nw;
  int tt1, tt2, tt3, tt4;
  double u1, u2, u3, u4, u5, u6, u7, u8, u9;
  char c1, c2, c3;
  srand((unsigned)time(0));
  input(st);
  input(en);
  cin >> n;
  for (i = 1; i <= n; i++) input(a[i]), a[i + n] = a[i];
  a[n + 1] = a[1];
  a[0] = a[n];
  point p;
  for (i = 1; i <= n; i++)
    if (p = cross(XL(a[i], a[i + 1]), XL(st, en)),
        (iscross(XL(a[i], a[i + 1]), XL(st, en)))) {
      cr[++cr_] = p;
      cr1[cr_] = i;
    }
  cout << setprecision(10) << fixed;
  double ans = 2000000000;
  if (cr_ == 0 || cr_ == 1) {
    cout << dis(st - en) << endl;
    return 0;
  }
  if (dis(cr[1] - st) > dis(cr[2] - st))
    swap(cr[1], cr[2]), swap(cr1[1], cr1[2]);
  ans = min(ans, dis(cr[1] - st) + dis(cr[2] - en) + dis(cr[1] - cr[2]) * 2);
  u1 = 0;
  t1 = cr1[1], t2 = cr1[2];
  if (t2 < t1) t2 += n;
  u1 += dis(cr[1] - st) + dis(cr[2] - en) + dis(cr[1] - a[t1 + 1]) +
        dis(cr[2] - a[t2]);
  for (i = t1 + 1; i <= t2 - 1; i++) u1 += dis(a[i] - a[i + 1]);
  ans = min(ans, u1);
  u1 = 0;
  t1 = cr1[1] + 1, t2 = cr1[2] + 1;
  if (t1 < t2) t1 += n;
  u1 += dis(cr[1] - st) + dis(cr[2] - en) + dis(cr[1] - a[t1 - 1]) +
        dis(cr[2] - a[t2]);
  for (i = t2 + 1; i <= t1 - 1; i++) u1 += dis(a[i] - a[i - 1]);
  ans = min(ans, u1);
  cout << ans << endl;
  return 0;
}