#include <bits/stdc++.h>
#include <algorithm>
#include <cmath>
#include <set>
#include <cstdio>
#include <vector>
#include <iostream>
#include <utility>
#include <queue>
#include <map>
#include <complex>
#define fir first
#define sec second
#define sz(s) (s).size()
#define pb push_back
#define get(n) scanf("%d",&n);
#define gets(s) string s;cin >> (s);
#define prfi(n) printf("%d", &n);
#define prfd(n) printf("%lf", &n);
#define All(s) (s).begin(), (s).end()
#define rep(i,j) for(int (i)=0;(i)<(j);(i)++)
#define For(i,j,k) for(int (i)=(j);(i)<(k);(i)++)
#define drep(i,j) for(int (i)=(j);(i)>=0;(i)--)
#define Ford(i,j,k) for(int (i)=(j);i>=(k);i--)
#define fore(c,v) for(auto (c): (v))
#define lp for(int __=0;__<n;i++)
#define mem(a,b) memset(a,b,sizeof(a));
#define dump(x)  std::cout << #x << " = " << (x) << std::endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
using ull = unsigned long long int;
using ll = long long;
using ld = long double;
using pii = std::pair<int,int>;
using pll = std::pair<ll, ll>;
using vi = std::vector<int> ;
using vvi = std::vector<vi> ;
using vll = std::vector<ll>;
using vvll = std::vector<vll>;
using vd = std::vector<double> ;
using vvd = std::vector<vd> ;
using qi = std::queue<int> ;
using vpii = std::vector<std::pair<int, int> >;
using vpll = std::vector<pll>;
using namespace std;

const int Mod = (1e9) + 7;
const int INF = 1e9 + 19;
const ll INFL = 1e18 + 19;
const int dx[] = {-1, 0, 0, 1};
const int dy[] = {0, -1, 1, 0};
const int dx2[] = {-1, -1, -1, 0, 0, 0, 1, 1, 1};
const int dy2[] = {1, 0, -1, 1, 0, -1, 1, 0, -1};
const double EPS = 1e-10;
//_____________________________________Templates_________________________________________//

template<class T1, class T2> inline void chmin(T1 &a, T2 b){if(a > b) a = b;}
template<class T1, class T2> inline void chmax(T1 &a, T2 b){if(a < b) a = b;}
template<class T> inline void pri(T a){cout << a << endl;}
template<class Z> using vec = vector<Z>;
template<class T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
//mainly use for dynamic prog
template<class T1, class T2>
void update(T1 &a, T2 b){
  a += b;
  if(a > Mod) a %= Mod;
}

inline void IN(void){
  return;
}

template <typename First, typename... Rest>
void IN(First& first, Rest&... rest){
  cin >> first;
  IN(rest...);
  return;
}

inline void OUT(void){
  cout << "\n";
  return;
}

template <typename First, typename... Rest>
void OUT(First first, Rest... rest){
  cout << first << " ";
  OUT(rest...);
  return;
}

bool pairsort(pll pl, pll pr){
  if(pl.first == pr.first)return pl.second > pr.second;
  return pl.first < pr.first;
}

int cntbit(ll a,int n,int j){int res = 0;For(i,j,n){if(a>>i & 1){res++;}}return res;}
vector<int> make_bit(int a){vector<int> res; for(int i=31;i>=0;i--)if(a&(1<<i))res.pb(i);return res;}
bool stdbit(int a, int b){return a&(1 << b); }
int GCD(int a, int b){if(b > a)return GCD(b,a);if(a%b == 0)return b;else return GCD(b, a%b);}
int LCM(int a, int b){return a*b/GCD(a,b);}
int roundup(int a, int b){if(a % b == 0)return a/b;else return (a+b)/b;}
int rounddown(int a, int b){if(a%b == 0)return a/b;else {return (a-b)/b;}}
ll pow(ll a, ll n){ll res = 1;while(n > 0){if(n&1)res *= a; a *= a; n = n >> 1;}return res;}
ll GetDiviserCount(ll N)//約数の個数
{
  ll res = 1;
  For(i,2,sqrt(N)+1)
  {
    ll cnt = 0;
    while(N%i == 0)
    {
      cnt++;
      N /= i;
    }
    res *= (cnt + 1);
    if(N == 1)break;
  }
  if(N != 1)res *= 2;
  return res;
}
vll GetDivisor(ll N)//約数列挙
{
  vll res;
  for(ll i = 1;i*i <= N;i++)
  {
    if(N%i == 0)
    {
      res.pb(i);
      if(i*i != N)res.pb(N/i);
    }
  }
  sort(All(res));
  return res;
}


struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%Mod+Mod)%Mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= Mod) x -= Mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += Mod-a.x) >= Mod) x -= Mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= Mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }
 
  // for prime mod
  mint inv() const {
    return pow(Mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
  friend ostream& operator<<(ostream& os, const mint& a);
};
ostream& operator<<(ostream& os, const mint& a)
{
  os << a.x;
  return os;
}
struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < Mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
};
 
template<class Z>
struct MyMatrix
{
  using mat = MyMatrix<Z>;
  vector<vector<Z>> m_dat;
  int m_h;
  int m_w;
  MyMatrix(int h, int w) : m_h(h), m_w(w) ,m_dat(h,vector<Z>(w)) {}
  vector<Z> &operator[] (int idx)
  {
    return m_dat[idx];
  }
  mat Multiple(mat &a)
  {
    mat C(m_h, a.m_w);
    for(int i=0;i<m_h;i++)
    {
      for(int j=0;j<a.m_w;j++)
      {
        for(int k=0;k<m_w;k++)
        {
         C[i][j] += m_dat[i][k] * a[k][j];
        }
      }
    }
    return C;
  }
  mat Pow(ll x)
  {
    mat B(m_h,m_w);
    for(int i=0;i<m_h;i++)
    {
      B[i][i] = 1;
    }
    mat A = *this;
    while(x > 0)
    {
      if(x&1)B = B.Multiple(A);
      A = A.Multiple(A);
      x = x >> 1;
    }
    return B;
  }
  //friend ostream& operator<<(ostream &os, const mat &A);
};
/*
template<class Z>
ostream& operator<<(ostream &os, Matrix<Z>& A)
{
  for(int i=0;i<A.m_h;i++)
  {
    for(int j=0;j<A.m_w;j++)
    {
      os << A[i][j] << " ";
    }
    os << endl;
  }
  return os;
}
*/
template<class T>
using mat = MyMatrix<T>;
//_____________________　following sorce code_________________________//
const int max_n = 3 * (1e5) + 1;
const int max_m = 83 * (1e5) + 1;

int n,m,k;
ll N;
int h,w;
string S;
//int a,b,c;
vi v;
int ans;
double x,y,z;
int a[2],b[2];
vector<int> G[1010101];
struct Data
{ 
  int cost;
  int x,y;
  Data(int cost,int x,int y) : cost(cost),x(x),y(y) {}
  bool operator>(const Data &a) const
  {
    return cost > a.cost;
  }
};
mint times[1000][1000];
int cost[1000][10000];
int visit[1010][1010];
void Dijkstra()
{
  min_priority_queue<Data> qu;
  memset(times,0,sizeof(times));
  memset(cost,INF,sizeof(cost));
  memset(visit,false,sizeof(visit));
  qu.push(Data(0,a[0],b[0]));
  times[a[0]][b[0]] = 1;
  cost[a[0]][b[0]] = 0;
  while(qu.size())
  {
    auto e = qu.top(); qu.pop();
    if(visit[e.x][e.y])continue;
    visit[e.x][e.y] = true;
    rep(i,4)
    {
      int nx = e.x + dx[i];
      int ny = e.y + dy[i];
      if(nx >= 0 and nx < h and ny >= 0 and ny < w)
      {
        if(cost[nx][ny] == e.cost + 1)
        {
          times[nx][ny] += times[e.x][e.y];
          qu.push(Data(e.cost+1,nx,ny));
        }
        if(cost[nx][ny] > e.cost + 1)
        {
          times[nx][ny] = times[e.x][e.y];
          cost[nx][ny] = e.cost + 1;
          qu.push(Data(e.cost+1,nx,ny));
        }
      }
    }

    if(e.x != 0)
    {
      if(cost[0][e.y] == e.cost + 1)
      {
        times[0][e.y] += times[e.x][e.y];
        qu.push(Data(e.cost+1,0,e.y));
      }
      else if(cost[0][e.y] > e.cost + 1)
      {
        times[0][e.y] = times[e.x][e.y];
        cost[0][e.y] = e.cost + 1;
        qu.push(Data(e.cost+1,0,e.y));
      }
    }
    if(e.x != h-1)
    {
      if(cost[h-1][e.y] == e.cost + 1)
      {
        times[h-1][e.y] += times[e.x][e.y];
        qu.push(Data(e.cost+1,h-1,e.y));
      }
      else if(cost[h-1][e.y] > e.cost + 1)
      {
        times[h-1][e.y] = times[e.x][e.y];
        cost[h-1][e.y] = e.cost + 1;
        qu.push(Data(e.cost+1,h-1,e.y));
      }
    }
    if(e.y != 0)
    {
      if(cost[e.x][0] == e.cost + 1)
      {
        times[e.x][0] += times[e.x][e.y];
        qu.push(Data(e.cost+1,e.x,0));
      }
      else if(cost[e.x][0] > e.cost + 1)
      {
        times[e.x][0] = times[e.x][e.y];
        cost[e.x][0] = e.cost + 1;
        qu.push(Data(e.cost+1,e.x,0));
      }
    }
    if(e.y != w-1)
    {
      if(cost[e.x][w-1] == e.cost + 1)
      {
        times[e.x][w-1] += times[e.x][e.y];
        qu.push(Data(e.cost+1,e.x,w-1));
      }
      else if(cost[e.x][w-1] > e.cost + 1)
      {
        times[e.x][w-1] = times[e.x][e.y];
        cost[e.x][w-1] = e.cost + 1;
        qu.push(Data(e.cost+1,e.x,w-1));
      }
    }
  }
}

signed main (int argc, char* argv[]) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  IN(h,w,a[0],b[0],a[1],b[1]);
  Dijkstra();
  cout << cost[a[1]][b[1]] << " " << times[a[1]][b[1]] << endl;
  //dump(times[1][1]);
  //for(auto c : ans){cout << c << endl;}
  //cout << fixed << setprecision(15) << ans << endl;
  return 0;
}

### Prompt

Generate a cpp solution to the following problem:

Problem

There is a grid of $ R \ times C $ squares with $ (0, 0) $ in the upper left and $ (R-1, C-1) $ in the lower right. When you are in a square ($ e $, $ f $), from there $ (e + 1, f) $, $ (e-1, f) $, $ (e, f + 1) $, $ (e) , f-1) $, $ (e, 0) $, $ (e, C-1) $, $ (0, f) $, $ (R-1, f) $ can be moved at a cost of $ 1 $ .. However, you cannot go out of the grid. When moving from the mass $ (a_i, a_j) $ to $ (b_i, b_j) $, calculate the cost of the shortest path and the remainder of the total number of shortest path combinations divided by $ 10 ^ 9 + 7 $.

However, the combination of routes shall be distinguished by the method of movement. For example, if your current location is $ (100, 1) $, you can go to $ (100, 0) $ with the above $ (e, f-1) $ or $ (e, 0) $ to get to $ (100, 0) $ at the shortest cost. You can do it, so count it as $ 2 $.

Constraints

The input satisfies the following conditions.

* $ 1 \ le R, C \ le 500 $
* $ 0 \ le a_i, b_i \ le R --1 $
* $ 0 \ le a_j, b_j \ le C --1 $
* All inputs given are integers.

Input

The input is given in the following format.


$ R $ $ C $ $ a_i $ $ a_j $ $ b_i $ $ b_j $


Output

When moving from the mass $ (a_i, a_j) $ to $ (b_i, b_j) $, the cost of the shortest path and the remainder of the total number of combinations of the shortest paths divided by $ 10 ^ 9 + 7 $ are separated by $ 1 $. Print on a line.

Examples

Input

2 2 0 0 1 1


Output

2 8


Input

1 1 0 0 0 0


Output

0 1


Input

1 10 0 0 0 9


Output

1 1


Input

5 5 0 0 4 4


Output

2 2


Input

421 435 196 169 388 9


Output

43 917334776

### Response

```cpp
#include <bits/stdc++.h>
#include <algorithm>
#include <cmath>
#include <set>
#include <cstdio>
#include <vector>
#include <iostream>
#include <utility>
#include <queue>
#include <map>
#include <complex>
#define fir first
#define sec second
#define sz(s) (s).size()
#define pb push_back
#define get(n) scanf("%d",&n);
#define gets(s) string s;cin >> (s);
#define prfi(n) printf("%d", &n);
#define prfd(n) printf("%lf", &n);
#define All(s) (s).begin(), (s).end()
#define rep(i,j) for(int (i)=0;(i)<(j);(i)++)
#define For(i,j,k) for(int (i)=(j);(i)<(k);(i)++)
#define drep(i,j) for(int (i)=(j);(i)>=0;(i)--)
#define Ford(i,j,k) for(int (i)=(j);i>=(k);i--)
#define fore(c,v) for(auto (c): (v))
#define lp for(int __=0;__<n;i++)
#define mem(a,b) memset(a,b,sizeof(a));
#define dump(x)  std::cout << #x << " = " << (x) << std::endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
using ull = unsigned long long int;
using ll = long long;
using ld = long double;
using pii = std::pair<int,int>;
using pll = std::pair<ll, ll>;
using vi = std::vector<int> ;
using vvi = std::vector<vi> ;
using vll = std::vector<ll>;
using vvll = std::vector<vll>;
using vd = std::vector<double> ;
using vvd = std::vector<vd> ;
using qi = std::queue<int> ;
using vpii = std::vector<std::pair<int, int> >;
using vpll = std::vector<pll>;
using namespace std;

const int Mod = (1e9) + 7;
const int INF = 1e9 + 19;
const ll INFL = 1e18 + 19;
const int dx[] = {-1, 0, 0, 1};
const int dy[] = {0, -1, 1, 0};
const int dx2[] = {-1, -1, -1, 0, 0, 0, 1, 1, 1};
const int dy2[] = {1, 0, -1, 1, 0, -1, 1, 0, -1};
const double EPS = 1e-10;
//_____________________________________Templates_________________________________________//

template<class T1, class T2> inline void chmin(T1 &a, T2 b){if(a > b) a = b;}
template<class T1, class T2> inline void chmax(T1 &a, T2 b){if(a < b) a = b;}
template<class T> inline void pri(T a){cout << a << endl;}
template<class Z> using vec = vector<Z>;
template<class T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
//mainly use for dynamic prog
template<class T1, class T2>
void update(T1 &a, T2 b){
  a += b;
  if(a > Mod) a %= Mod;
}

inline void IN(void){
  return;
}

template <typename First, typename... Rest>
void IN(First& first, Rest&... rest){
  cin >> first;
  IN(rest...);
  return;
}

inline void OUT(void){
  cout << "\n";
  return;
}

template <typename First, typename... Rest>
void OUT(First first, Rest... rest){
  cout << first << " ";
  OUT(rest...);
  return;
}

bool pairsort(pll pl, pll pr){
  if(pl.first == pr.first)return pl.second > pr.second;
  return pl.first < pr.first;
}

int cntbit(ll a,int n,int j){int res = 0;For(i,j,n){if(a>>i & 1){res++;}}return res;}
vector<int> make_bit(int a){vector<int> res; for(int i=31;i>=0;i--)if(a&(1<<i))res.pb(i);return res;}
bool stdbit(int a, int b){return a&(1 << b); }
int GCD(int a, int b){if(b > a)return GCD(b,a);if(a%b == 0)return b;else return GCD(b, a%b);}
int LCM(int a, int b){return a*b/GCD(a,b);}
int roundup(int a, int b){if(a % b == 0)return a/b;else return (a+b)/b;}
int rounddown(int a, int b){if(a%b == 0)return a/b;else {return (a-b)/b;}}
ll pow(ll a, ll n){ll res = 1;while(n > 0){if(n&1)res *= a; a *= a; n = n >> 1;}return res;}
ll GetDiviserCount(ll N)//約数の個数
{
  ll res = 1;
  For(i,2,sqrt(N)+1)
  {
    ll cnt = 0;
    while(N%i == 0)
    {
      cnt++;
      N /= i;
    }
    res *= (cnt + 1);
    if(N == 1)break;
  }
  if(N != 1)res *= 2;
  return res;
}
vll GetDivisor(ll N)//約数列挙
{
  vll res;
  for(ll i = 1;i*i <= N;i++)
  {
    if(N%i == 0)
    {
      res.pb(i);
      if(i*i != N)res.pb(N/i);
    }
  }
  sort(All(res));
  return res;
}


struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%Mod+Mod)%Mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= Mod) x -= Mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += Mod-a.x) >= Mod) x -= Mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= Mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }
 
  // for prime mod
  mint inv() const {
    return pow(Mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
  friend ostream& operator<<(ostream& os, const mint& a);
};
ostream& operator<<(ostream& os, const mint& a)
{
  os << a.x;
  return os;
}
struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < Mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
};
 
template<class Z>
struct MyMatrix
{
  using mat = MyMatrix<Z>;
  vector<vector<Z>> m_dat;
  int m_h;
  int m_w;
  MyMatrix(int h, int w) : m_h(h), m_w(w) ,m_dat(h,vector<Z>(w)) {}
  vector<Z> &operator[] (int idx)
  {
    return m_dat[idx];
  }
  mat Multiple(mat &a)
  {
    mat C(m_h, a.m_w);
    for(int i=0;i<m_h;i++)
    {
      for(int j=0;j<a.m_w;j++)
      {
        for(int k=0;k<m_w;k++)
        {
         C[i][j] += m_dat[i][k] * a[k][j];
        }
      }
    }
    return C;
  }
  mat Pow(ll x)
  {
    mat B(m_h,m_w);
    for(int i=0;i<m_h;i++)
    {
      B[i][i] = 1;
    }
    mat A = *this;
    while(x > 0)
    {
      if(x&1)B = B.Multiple(A);
      A = A.Multiple(A);
      x = x >> 1;
    }
    return B;
  }
  //friend ostream& operator<<(ostream &os, const mat &A);
};
/*
template<class Z>
ostream& operator<<(ostream &os, Matrix<Z>& A)
{
  for(int i=0;i<A.m_h;i++)
  {
    for(int j=0;j<A.m_w;j++)
    {
      os << A[i][j] << " ";
    }
    os << endl;
  }
  return os;
}
*/
template<class T>
using mat = MyMatrix<T>;
//_____________________　following sorce code_________________________//
const int max_n = 3 * (1e5) + 1;
const int max_m = 83 * (1e5) + 1;

int n,m,k;
ll N;
int h,w;
string S;
//int a,b,c;
vi v;
int ans;
double x,y,z;
int a[2],b[2];
vector<int> G[1010101];
struct Data
{ 
  int cost;
  int x,y;
  Data(int cost,int x,int y) : cost(cost),x(x),y(y) {}
  bool operator>(const Data &a) const
  {
    return cost > a.cost;
  }
};
mint times[1000][1000];
int cost[1000][10000];
int visit[1010][1010];
void Dijkstra()
{
  min_priority_queue<Data> qu;
  memset(times,0,sizeof(times));
  memset(cost,INF,sizeof(cost));
  memset(visit,false,sizeof(visit));
  qu.push(Data(0,a[0],b[0]));
  times[a[0]][b[0]] = 1;
  cost[a[0]][b[0]] = 0;
  while(qu.size())
  {
    auto e = qu.top(); qu.pop();
    if(visit[e.x][e.y])continue;
    visit[e.x][e.y] = true;
    rep(i,4)
    {
      int nx = e.x + dx[i];
      int ny = e.y + dy[i];
      if(nx >= 0 and nx < h and ny >= 0 and ny < w)
      {
        if(cost[nx][ny] == e.cost + 1)
        {
          times[nx][ny] += times[e.x][e.y];
          qu.push(Data(e.cost+1,nx,ny));
        }
        if(cost[nx][ny] > e.cost + 1)
        {
          times[nx][ny] = times[e.x][e.y];
          cost[nx][ny] = e.cost + 1;
          qu.push(Data(e.cost+1,nx,ny));
        }
      }
    }

    if(e.x != 0)
    {
      if(cost[0][e.y] == e.cost + 1)
      {
        times[0][e.y] += times[e.x][e.y];
        qu.push(Data(e.cost+1,0,e.y));
      }
      else if(cost[0][e.y] > e.cost + 1)
      {
        times[0][e.y] = times[e.x][e.y];
        cost[0][e.y] = e.cost + 1;
        qu.push(Data(e.cost+1,0,e.y));
      }
    }
    if(e.x != h-1)
    {
      if(cost[h-1][e.y] == e.cost + 1)
      {
        times[h-1][e.y] += times[e.x][e.y];
        qu.push(Data(e.cost+1,h-1,e.y));
      }
      else if(cost[h-1][e.y] > e.cost + 1)
      {
        times[h-1][e.y] = times[e.x][e.y];
        cost[h-1][e.y] = e.cost + 1;
        qu.push(Data(e.cost+1,h-1,e.y));
      }
    }
    if(e.y != 0)
    {
      if(cost[e.x][0] == e.cost + 1)
      {
        times[e.x][0] += times[e.x][e.y];
        qu.push(Data(e.cost+1,e.x,0));
      }
      else if(cost[e.x][0] > e.cost + 1)
      {
        times[e.x][0] = times[e.x][e.y];
        cost[e.x][0] = e.cost + 1;
        qu.push(Data(e.cost+1,e.x,0));
      }
    }
    if(e.y != w-1)
    {
      if(cost[e.x][w-1] == e.cost + 1)
      {
        times[e.x][w-1] += times[e.x][e.y];
        qu.push(Data(e.cost+1,e.x,w-1));
      }
      else if(cost[e.x][w-1] > e.cost + 1)
      {
        times[e.x][w-1] = times[e.x][e.y];
        cost[e.x][w-1] = e.cost + 1;
        qu.push(Data(e.cost+1,e.x,w-1));
      }
    }
  }
}

signed main (int argc, char* argv[]) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  IN(h,w,a[0],b[0],a[1],b[1]);
  Dijkstra();
  cout << cost[a[1]][b[1]] << " " << times[a[1]][b[1]] << endl;
  //dump(times[1][1]);
  //for(auto c : ans){cout << c << endl;}
  //cout << fixed << setprecision(15) << ans << endl;
  return 0;
}

```