Petya recently found a game "Choose a Square". In this game, there are n points numbered from 1 to n on an infinite field. The i-th point has coordinates (x_i, y_i) and cost c_i.

You have to choose a square such that its sides are parallel to coordinate axes, the lower left and upper right corners belong to the line y = x, and all corners have integer coordinates.

The score you get is the sum of costs of the points covered by the selected square minus the length of the side of the square. Note that the length of the side can be zero.

Petya asks you to calculate the maximum possible score in the game that can be achieved by placing exactly one square.

Input

The first line of the input contains one integer n (1 ≤ n ≤ 5 ⋅ 10^5) — the number of points on the field.

Each of the following n lines contains three integers x_i, y_i, c_i (0 ≤ x_i, y_i ≤ 10^9, -10^6 ≤ c_i ≤ 10^6) — coordinates of the i-th point and its cost, respectively.

Output

In the first line print the maximum score Petya can achieve.

In the second line print four integers x_1, y_1, x_2, y_2 (0 ≤ x_1, y_1, x_2, y_2 ≤ 2 ⋅ 10^9, x_1 = y_1, x_2 = y_2, x_1 ≤ x_2) separated by spaces — the coordinates of the lower left and upper right corners of the square which Petya has to select in order to achieve the maximum score.

Examples

Input


6
0 0 2
1 0 -5
1 1 3
2 3 4
1 4 -4
3 1 -1


Output


4
1 1 3 3


Input


5
3 3 0
3 3 -3
0 2 -1
3 1 3
0 0 -2


Output


0
1 1 1 1

Note

The field corresponding to the first example: <image>
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
using namespace std;
template <class T>
inline bool setmin(T &a, T b) {
  if (a > b) return a = b, 1;
  return 0;
}
template <class T>
inline bool setmax(T &a, T b) {
  if (a < b) return a = b, 1;
  return 0;
}
template <class T>
inline T fast(T a, T b, T mod) {
  long long res = 1;
  while (b) {
    if (b & 1) res = (res * a) % mod;
    a = (a * a) % mod;
    b >>= 1;
  }
  return res;
}
template <class T>
inline T russian(T a, T b, T mod) {
  long long res = 0;
  while (b) {
    if (b & 1) res = (res + a) % mod;
    a = (a + a) % mod;
    b >>= 1;
  }
  return res;
}
template <class T>
istream &operator>>(istream &os, vector<T> &container) {
  for (auto &u : container) os >> u;
  return os;
}
template <class T>
ostream &operator<<(ostream &os, const vector<T> &container) {
  for (auto &u : container) os << u << " ";
  return os;
}
template <typename T>
inline T gcd(T a, T b) {
  while (b) swap(a %= b, b);
  return a;
}
const long long INF = 1e9 + 7;
const long long mod = 998244353;
const long long BIG_INF = 1e18 + 7;
const long long N = 1e6 + 7;
const int LOG = 17;
int n, m, k, q;
template <int SZ>
struct dodaj_znajdz_max {
  pair<int, long long> tree[SZ * 4 + 2];
  long long lazy[SZ * 4 + 2];
  int poz_max;
  long long wart_max;
  int T;
  dodaj_znajdz_max(long long val = 0) {
    T = 1;
    while (T <= SZ) T <<= 1;
    fill(lazy, lazy + T + T, 0);
    for (int i = T; i < T + T; i++) tree[i] = {i - T, val};
    for (int i = T - 1; i >= 1; i--) pull(i);
  }
  void add(int pocz, int kon, long long val) {
    ADD(pocz + T, kon + T + 1, 1, T, T + T, val);
  }
  pair<int, long long> ask(int pocz, int kon) {
    wart_max = -BIG_INF;
    ASK(T + pocz, T + kon + 1, 1, T, T + T);
    return {poz_max, wart_max};
  }

 private:
  void push(int u) {
    tree[u].second += lazy[u];
    long long pom = lazy[u];
    lazy[u] = 0;
    if (u >= T) return;
    lazy[u * 2] += pom;
    lazy[u * 2 + 1] += pom;
  }
  void pull(int u) {
    if (u < T)
      tree[u] = {
          (tree[u * 2].second > tree[u * 2 + 1].second ? tree[u * 2].first
                                                       : tree[u * 2 + 1].first),
          max(tree[u * 2].second, tree[u * 2 + 1].second) + lazy[u]};
    else {
      tree[u] = {tree[u].first, tree[u].second + lazy[u]};
      lazy[u] = 0;
    }
  }
  void ADD(int a, int b, int u, int lo, int hi, long long val) {
    push(u);
    if (a >= b) return;
    if (a == lo && b == hi) {
      lazy[u] += val;
      push(u);
      return;
    }
    push(u);
    int mid = (lo + hi) / 2;
    ADD(a, min(mid, b), u * 2, lo, mid, val);
    ADD(max(a, mid), b, u * 2 + 1, mid, hi, val);
    pull(u);
  }
  void ASK(int a, int b, int u, int lo, int hi) {
    push(u);
    if (a >= b) return;
    if (a == lo && b == hi) {
      if (tree[u].second > wart_max) {
        wart_max = tree[u].second;
        poz_max = tree[u].first;
      }
      return;
    }
    push(u);
    int mid = (lo + hi) / 2;
    ASK(a, min(mid, b), u * 2, lo, mid);
    ASK(max(a, mid), b, u * 2 + 1, mid, hi);
    pull(u);
  }
};
map<int, long long> mapa, mapa_rev;
map<pair<int, int>, long long> lol;
vector<pair<pair<int, int>, long long>> poziome, pionowe;
dodaj_znajdz_max<1000999> dzewo;
void zmapuj(vector<int> &tab) {
  sort((tab).begin(), (tab).end());
  tab.resize(unique((tab).begin(), (tab).end()) - tab.begin());
  for (int i = 0; i < (int)(tab).size(); i++) {
    mapa[tab[i]] = i;
    mapa_rev[i] = tab[i];
  }
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> n;
  vector<int> id;
  for (int i = 0; i < n; i++) {
    int a, b;
    long long c;
    cin >> a >> b >> c;
    if (a > b) swap(a, b);
    lol[{a, b}] += c;
    id.push_back(a);
    id.push_back(b);
  }
  zmapuj(id);
  for (auto &u : lol) {
    poziome.push_back({{mapa[u.first.first], mapa[u.first.second]}, u.second});
    pionowe.push_back({{mapa[u.first.first], mapa[u.first.second]}, u.second});
  }
  sort((poziome).rbegin(), (poziome).rend());
  sort((pionowe).rbegin(), (pionowe).rend());
  int id_poziome = 0;
  int id_pionowe = 0;
  pair<int, int> best_poz = {-1, -1};
  long long best_wyn = -1;
  vector<long long> roznice;
  int chlew = 0;
  long long ost = -1;
  for (auto &u : mapa_rev) {
    if (chlew) roznice.push_back(u.second - ost);
    ost = u.second;
    chlew++;
  }
  reverse((roznice).begin(), (roznice).end());
  for (int i = (int)(id).size() - 1; i >= 0; i--) {
    if (i < (int)(id).size() - 1)
      dzewo.add(i + 1, (int)(id).size() - 1,
                -roznice[(int)(id).size() - 2 - i]);
    int last = id_poziome;
    while (id_poziome < (int)(poziome).size() &&
           poziome[id_poziome].first.first == i) {
      dzewo.add(poziome[id_poziome].first.second, (int)(id).size() - 1,
                poziome[id_poziome].second);
      id_poziome++;
    }
    pair<int, long long> best = dzewo.ask(i, (int)(id).size() - 1);
    if (best.second > best_wyn) {
      best_wyn = best.second;
      best_poz = {mapa_rev[i], mapa_rev[best.first]};
    }
  }
  if (best_wyn <= 0) {
    cout << 0 << '\n';
    srand(time(0));
    long long x = 200 + rand() % 500;
    x = x * x * x;
    cout << x << ' ' << x << ' ' << x << ' ' << x << '\n';
    exit(0);
  }
  cout << best_wyn << '\n';
  cout << best_poz.first << ' ' << best_poz.first << ' ' << best_poz.second
       << ' ' << best_poz.second << '\n';
}
