#include <iostream>
#include <cmath>

using namespace std;

int main() {

    int N, X0, Y0, XN2, YN2;
    cin >> N >> X0 >> Y0 >> XN2 >> YN2;

    double xo, yo;
    xo = (double)(X0 + XN2) / 2;
    yo = (double)(Y0 + YN2) / 2;

    double X0d, Y0d;
    X0d = X0 - xo;
    Y0d = Y0 - yo;

    double pi = 3.1415926535;
    double p = pi / (N / 2);

    double x1d, y1d;
    x1d = X0d * cos(p) - Y0d * sin(p);
    y1d = X0d * sin(p) + Y0d * cos(p);

    double x1, y1;
    x1 = x1d + xo;
    y1 = y1d + yo;

    cout << x1 << " " << y1 << endl;
    

    return 0;
}
#line 2 "/Users/tiramister/CompetitiveProgramming/Cpp/CppLibrary/Graph/dijkstra.hpp"

#line 2 "/Users/tiramister/CompetitiveProgramming/Cpp/CppLibrary/Tools/heap_alias.hpp"

#include <queue>

template <class T>
using MaxHeap = std::priority_queue<T>;
template <class T>
using MinHeap = std::priority_queue<T, std::vector<T>, std::greater<T>>;
#line 2 "/Users/tiramister/CompetitiveProgramming/Cpp/CppLibrary/Graph/graph.hpp"

#include <vector>

template <class Cost = int>
struct Edge {
    int src, dst;
    Cost cost;

    Edge() = default;
    Edge(int src, int dst, Cost cost = 1)
        : src(src), dst(dst), cost(cost){};

    bool operator<(const Edge<Cost>& e) const { return cost < e.cost; }
    bool operator>(const Edge<Cost>& e) const { return cost > e.cost; }
};

template <class Cost = int>
struct Graph : public std::vector<std::vector<Edge<Cost>>> {
    using std::vector<std::vector<Edge<Cost>>>::vector;

    void span(bool direct, int src, int dst, Cost cost = 1) {
        (*this)[src].emplace_back(src, dst, cost);
        if (!direct) (*this)[dst].emplace_back(dst, src, cost);
    }
};
#line 5 "/Users/tiramister/CompetitiveProgramming/Cpp/CppLibrary/Graph/dijkstra.hpp"

template <class Cost>
std::vector<Cost> dijkstra(const Graph<Cost>& graph, int s) {
    std::vector<Cost> dist(graph.size(), -1);
    dist[s] = 0;
    MinHeap<std::pair<Cost, int>> que;
    que.emplace(0, s);

    while (!que.empty()) {
        auto [d, v] = que.top();
        que.pop();
        if (d > dist[v]) continue;

        for (const auto& e : graph[v]) {
            if (dist[e.dst] != -1 &&
                dist[e.dst] <= dist[v] + e.cost) continue;
            dist[e.dst] = dist[v] + e.cost;
            que.emplace(dist[e.dst], e.dst);
        }
    }

    return dist;
}
#line 2 "main.cpp"
#include <iostream>

using namespace std;
constexpr int N = 100;

int enc(int x, int t) { return x + t * N; }

void solve() {
    int a, b, x, y;
    cin >> a >> b >> x >> y;
    int s = enc(--a, 0), g = enc(--b, 1);

    Graph<int> graph(N * 2);
    for (int i = 0; i < N; ++i) {
        graph.span(false, enc(i, 0), enc(i, 1), x);

        if (i + 1 < N) {
            graph.span(false, enc(i + 1, 0), enc(i, 1), x);
            for (int t = 0; t < 2; ++t) {
                graph.span(false, enc(i, t), enc(i + 1, t), y);
            }
        }
    }

    cout << dijkstra(graph, s)[g] << "\n";
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    solve();

    return 0;
}
