#include #include void solve() { int r, c, x1, y1, x2, y2; std::cin >> r >> c >> x1 >> y1 >> x2 >> y2; std::cout << std::abs(x1 - x2) + std::abs(y1 - y2) << std::endl; } int main() { std::cin.tie(nullptr); std::ios::sync_with_stdio(false); solve(); return 0; }