#include <bits/stdc++.h>
using namespace std;
int N, M;
pair<long long, long long> arr[200005], s;
long double dist(int a, int b) {
  return sqrt((arr[a].first - arr[b].first) * (arr[a].first - arr[b].first) +
              (arr[a].second - arr[b].second) *
                  (arr[a].second - arr[b].second));
}
bool chk(int a, int b, int c) {
  return ((arr[b].first - arr[a].first) * (arr[c].second - arr[a].second) -
          (arr[c].first - arr[a].first) * (arr[b].second - arr[a].second)) == 0;
}
int main() {
  cin >> N >> M;
  for (int i = 1; i <= N; ++i) {
    cin >> arr[i].first >> arr[i].second;
  }
  s = arr[M];
  if (chk(1, 2, 3)) {
    for (int i = 4; i <= N; ++i) {
      if (!chk(1, 2, i)) {
        swap(arr[i], arr[N]);
        break;
      }
    }
  } else if (N > 3) {
    if (chk(1, 2, 4)) {
      swap(arr[3], arr[N]);
    } else if (chk(1, 3, 4)) {
      swap(arr[2], arr[N]);
    } else {
      swap(arr[1], arr[N]);
    }
  }
  sort(arr + 1, arr + N);
  for (int i = 1; i <= N; ++i) {
    if (arr[i] == s) M = i;
  }
  cout << setprecision(10) << fixed;
  if (M == N) {
    cout << min(dist(1, N), dist(N - 1, N)) + dist(1, N - 1) << endl;
    return 0;
  }
  long double ans = dist(1, N - 1) + min(dist(1, M) + dist(N - 1, N),
                                         dist(M, N - 1) + dist(1, N));
  for (int i = 1; i < N - 1; ++i) {
    int A = i;
    int B = i + 1;
    int C = 1;
    int D = N - 1;
    if (i < M) {
      swap(A, B);
      swap(C, D);
    }
    ans = min(
        ans,
        min(dist(M, A) + dist(A, C) + dist(C, N) + dist(N, B) + dist(B, D),
            dist(M, C) + dist(C, A) + dist(A, N) + dist(N, B) + dist(B, D)));
  }
  cout << ans << endl;
  return 0;
}

### Prompt

Create a solution in Cpp for the following problem:

You are given N points on an infinite plane with the Cartesian coordinate system on it. N-1 points lay on one line, and one point isn't on that line. You are on point K at the start, and the goal is to visit every point. You can move between any two points in a straight line, and you can revisit points. What is the minimum length of the path? 

Input

The first line contains two integers: N (3 ≤ N ≤ 2*10^5) - the number of points, and K (1 ≤ K ≤ N) - the index of the starting point.

Each of the next N lines contain two integers, A_i, B_i (-10^6 ≤ A_i, B_i ≤ 10^6) - coordinates of the i-th point.

Output

The output contains one number - the shortest path to visit all given points starting from point K. The absolute difference between your solution and the main solution shouldn't exceed 10^-6;

Example

Input


5 2
0 0
-1 1
2 -2
0 1
-2 2


Output


7.478709

Note

The shortest path consists of these moves: 

2 -> 5 

5 -> 4 

4 -> 1 

1 -> 3 

There isn't any shorter path possible.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
int N, M;
pair<long long, long long> arr[200005], s;
long double dist(int a, int b) {
  return sqrt((arr[a].first - arr[b].first) * (arr[a].first - arr[b].first) +
              (arr[a].second - arr[b].second) *
                  (arr[a].second - arr[b].second));
}
bool chk(int a, int b, int c) {
  return ((arr[b].first - arr[a].first) * (arr[c].second - arr[a].second) -
          (arr[c].first - arr[a].first) * (arr[b].second - arr[a].second)) == 0;
}
int main() {
  cin >> N >> M;
  for (int i = 1; i <= N; ++i) {
    cin >> arr[i].first >> arr[i].second;
  }
  s = arr[M];
  if (chk(1, 2, 3)) {
    for (int i = 4; i <= N; ++i) {
      if (!chk(1, 2, i)) {
        swap(arr[i], arr[N]);
        break;
      }
    }
  } else if (N > 3) {
    if (chk(1, 2, 4)) {
      swap(arr[3], arr[N]);
    } else if (chk(1, 3, 4)) {
      swap(arr[2], arr[N]);
    } else {
      swap(arr[1], arr[N]);
    }
  }
  sort(arr + 1, arr + N);
  for (int i = 1; i <= N; ++i) {
    if (arr[i] == s) M = i;
  }
  cout << setprecision(10) << fixed;
  if (M == N) {
    cout << min(dist(1, N), dist(N - 1, N)) + dist(1, N - 1) << endl;
    return 0;
  }
  long double ans = dist(1, N - 1) + min(dist(1, M) + dist(N - 1, N),
                                         dist(M, N - 1) + dist(1, N));
  for (int i = 1; i < N - 1; ++i) {
    int A = i;
    int B = i + 1;
    int C = 1;
    int D = N - 1;
    if (i < M) {
      swap(A, B);
      swap(C, D);
    }
    ans = min(
        ans,
        min(dist(M, A) + dist(A, C) + dist(C, N) + dist(N, B) + dist(B, D),
            dist(M, C) + dist(C, A) + dist(A, N) + dist(N, B) + dist(B, D)));
  }
  cout << ans << endl;
  return 0;
}

```