#include <iostream>
#include <utility>
#include <tuple>
#include <vector>
#include <string>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <algorithm>
#include <functional>
#include <climits>
#include <numeric>
#include <queue>
#include <cmath>
#include <iomanip>
#include <array>
#include <string>
#include <stack>
#include <cassert>
#include <memory>
#include <random>
#include <fstream>
#include <cfloat>

static double vw, vc;
struct Position {
	double x, y;
	double distance(const Position& that) const {
		return std::sqrt((x - that.x) * (x - that.x) + (y - that.y) * (y - that.y));
	}
};
struct Line {
	Position from, to;
	int dx() const { return to.x - from.x; }
	int dy() const { return to.y - from.y; }
	int min_height() const { return std::min(from.y, to.y); }
	int max_height() const { return std::max(from.y, to.y); }
};
bool can_dig(const Line& left, const Line& right) {
	return left.dy() > 0 && right.dy() < 0 && left.min_height() < right.max_height() && left.max_height() > right.min_height();
}
Position move_to_height(const Line& line, const double height) {
	return Position{ line.from.x + (double)line.dx() * (height - line.from.y) / line.dy(), height };
}
double min_time_with_tunnel(const Line left, const Line right, const int height_limit = INT_MAX) {
	const auto min_height = std::max(left.min_height(), right.min_height());
	const auto max_height = std::min({ left.max_height(), right.max_height(), height_limit });
	std::vector<double> result;
	const auto lower_left = move_to_height(left, min_height);
	const auto lower_right = move_to_height(right, min_height);
	const auto lower = (lower_left.distance(left.from) + lower_right.distance(right.to)) / vw + lower_left.distance(lower_right) / vc;
	const auto higher_left = move_to_height(left, max_height);
	const auto higher_right = move_to_height(right, max_height);
	const auto higher = (higher_left.distance(left.from) + higher_right.distance(right.to)) / vw + higher_left.distance(higher_right) / vc;
	return std::min(lower, higher);
}
int main() {
	while (true) {
		int n; std::cin >> n; if (n == 0) break;
		std::cin >> vw >> vc;
		std::vector<Position> position(n);
		for (auto& p : position) std::cin >> p.x >> p.y;
		std::vector<Line> lines; lines.reserve(n - 1);
		for (auto i = 1; i < position.size(); ++i) {
			lines.push_back(Line{ position[i - 1], position[i] });
		}
		std::vector<double> min_distance(n, DBL_MAX); min_distance[n - 1] = 0;
		for (int right = n - 2; right >= 0; --right) {
			min_distance[right] = std::min(min_distance[right], min_distance[right + 1] + lines[right].from.distance(lines[right].to) / vw);
			int max_height = INT_MAX;
			for (int left = right - 1; left >= 0; --left) {
				if (max_height >= lines[left].min_height() && can_dig(lines[left], lines[right])) {
					const auto min = min_time_with_tunnel(lines[left], lines[right], max_height);
					min_distance[left] = std::min(min_distance[left], min_distance[right + 1] + min);
				}
				max_height = std::min(max_height, lines[left].min_height());
				if (lines[right].min_height() >= max_height) {
					break;
				}
			}
		}
		std::cout << std::setprecision(10) << std::fixed << min_distance.front() << '\n';
	}
}

### Prompt

Please create a solution in cpp to the following problem:

Benjamin Forest VIII is a king of a country. One of his best friends Nod lives in a village far from his castle. Nod gets seriously sick and is on the verge of death. Benjamin orders his subordinate Red to bring good medicine for him as soon as possible. However, there is no road from the castle to the village. Therefore, Red needs to climb over mountains and across canyons to reach the village. He has decided to get to the village on the shortest path on a map, that is, he will move on the straight line between the castle and the village. Then his way can be considered as polyline with n points (x1, y1) . . . (xn , yn ) as illustlated in the following figure.

<image>

Figure 1: An example route from the castle to the village

Here, xi indicates the distance between the castle and the point i, as the crow flies, and yi indicates the height of the point i. The castle is located on the point (x1 , y1 ), and the village is located on the point (xn , yn).

Red can walk in speed vw . Also, since he has a skill to cut a tunnel through a mountain horizontally, he can move inside the mountain in speed vc.

Your job is to write a program to the minimum time to get to the village.



Input

The input is a sequence of datasets. Each dataset is given in the following format:


n
vw vc
x1 y1
...
xn yn


You may assume all the following: n ≤ 1,000, 1 ≤ vw, vc ≤ 10, -10,000 ≤ xi, yi ≤ 10,000, and xi < xj for all i < j.

The input is terminated in case of n = 0. This is not part of any datasets and thus should not be processed.

Output

For each dataset, you should print the minimum time required to get to the village in a line. Each minimum time should be given as a decimal with an arbitrary number of fractional digits and with an absolute error of at most 10-6 . No extra space or character is allowed.

Example

Input

3
2 1
0 0
50 50
100 0
3
1 1
0 0
50 50
100 0
3
1 2
0 0
50 50
100 0
3
2 1
0 0
100 100
150 50
6
1 2
0 0
50 50
100 0
150 0
200 50
250 0
0


Output

70.710678
100.000000
50.000000
106.066017
150.000000

### Response

```cpp
#include <iostream>
#include <utility>
#include <tuple>
#include <vector>
#include <string>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <algorithm>
#include <functional>
#include <climits>
#include <numeric>
#include <queue>
#include <cmath>
#include <iomanip>
#include <array>
#include <string>
#include <stack>
#include <cassert>
#include <memory>
#include <random>
#include <fstream>
#include <cfloat>

static double vw, vc;
struct Position {
	double x, y;
	double distance(const Position& that) const {
		return std::sqrt((x - that.x) * (x - that.x) + (y - that.y) * (y - that.y));
	}
};
struct Line {
	Position from, to;
	int dx() const { return to.x - from.x; }
	int dy() const { return to.y - from.y; }
	int min_height() const { return std::min(from.y, to.y); }
	int max_height() const { return std::max(from.y, to.y); }
};
bool can_dig(const Line& left, const Line& right) {
	return left.dy() > 0 && right.dy() < 0 && left.min_height() < right.max_height() && left.max_height() > right.min_height();
}
Position move_to_height(const Line& line, const double height) {
	return Position{ line.from.x + (double)line.dx() * (height - line.from.y) / line.dy(), height };
}
double min_time_with_tunnel(const Line left, const Line right, const int height_limit = INT_MAX) {
	const auto min_height = std::max(left.min_height(), right.min_height());
	const auto max_height = std::min({ left.max_height(), right.max_height(), height_limit });
	std::vector<double> result;
	const auto lower_left = move_to_height(left, min_height);
	const auto lower_right = move_to_height(right, min_height);
	const auto lower = (lower_left.distance(left.from) + lower_right.distance(right.to)) / vw + lower_left.distance(lower_right) / vc;
	const auto higher_left = move_to_height(left, max_height);
	const auto higher_right = move_to_height(right, max_height);
	const auto higher = (higher_left.distance(left.from) + higher_right.distance(right.to)) / vw + higher_left.distance(higher_right) / vc;
	return std::min(lower, higher);
}
int main() {
	while (true) {
		int n; std::cin >> n; if (n == 0) break;
		std::cin >> vw >> vc;
		std::vector<Position> position(n);
		for (auto& p : position) std::cin >> p.x >> p.y;
		std::vector<Line> lines; lines.reserve(n - 1);
		for (auto i = 1; i < position.size(); ++i) {
			lines.push_back(Line{ position[i - 1], position[i] });
		}
		std::vector<double> min_distance(n, DBL_MAX); min_distance[n - 1] = 0;
		for (int right = n - 2; right >= 0; --right) {
			min_distance[right] = std::min(min_distance[right], min_distance[right + 1] + lines[right].from.distance(lines[right].to) / vw);
			int max_height = INT_MAX;
			for (int left = right - 1; left >= 0; --left) {
				if (max_height >= lines[left].min_height() && can_dig(lines[left], lines[right])) {
					const auto min = min_time_with_tunnel(lines[left], lines[right], max_height);
					min_distance[left] = std::min(min_distance[left], min_distance[right + 1] + min);
				}
				max_height = std::min(max_height, lines[left].min_height());
				if (lines[right].min_height() >= max_height) {
					break;
				}
			}
		}
		std::cout << std::setprecision(10) << std::fixed << min_distance.front() << '\n';
	}
}

```