#include <iostream> #include <cmath> using std::cin; using std::cout; using std::endl; const int xmax = 2159; const int ymax = 4095; class v2 { public: float x, y; v2() {}; v2(float _x, float _y) :x(_x), y(_y) {} }; bool checkBoundary(const v2& _a) { if (_a.x < 0 || _a.y < 0 || _a.x > xmax || _a.y > ymax) { return false; } else return true; } bool checkTangent(const v2& _a, const v2& _b) { if (abs(_a.x - _b.x) < abs(_a.y - _b.y)) return false; else return true; } void convertCordinate(v2& _a) { _a.y = ymax - _a.y; } double dotProduct(const v2& _a, const v2& _b) { return((double)(_a.x * _b.x + _a.y * _b.y)); } v2 identifyVec(v2& _a) { v2 tmp; tmp.x = _a.x / sqrt(_a.x * _a.x + _a.y * _a.y); tmp.y = _a.y / sqrt(_a.x * _a.x + _a.y * _a.y); return(tmp); } int main() { v2 a, b, c; cin >> a.x >> a.y; cin >> b.x >> b.y; if (checkBoundary(a) && checkBoundary(b) && checkTangent(a,b)) { convertCordinate(a); convertCordinate(b); if (a.x >= b.x) { c.x = a.x - b.x; c.y = a.y - b.y; } else { c.x = b.x - a.x; c.y = b.y - a.y; } v2 d = identifyVec(c); //cout << "c(" << c.x << ", " << c.y << ")" << endl; //cout << atan2(c.y, c.x) << endl; if (atan2(d.y, d.x) >= 0) { cout << "U " << abs(c.x) << " " << abs(c.y) << endl; } else { cout << "D " << abs(c.x) << " " << abs(c.y) << endl; } } else { cout << "Error" << endl; return 0; } return 0; }