#include <bits/stdc++.h>
using namespace std;
template <typename T>
T gcd(T first, T second) {
  while (second > 0) {
    first %= second;
    swap(first, second);
  }
  return first;
}
template <class T>
T lcm(T a, T b) {
  return a / gcd(a, b) * b;
}
template <class _T>
inline _T sqr(const _T &first) {
  return first * first;
}
template <class _T>
inline string tostr(const _T &a) {
  ostringstream os("");
  os << a;
  return os.str();
}
const long double PI = 3.1415926535897932384626433832795L;
template <typename T>
inline void input(T &a) {
  static int ed;
  a = 0;
  while (!isdigit(ed = getchar()) && ed != '-') {
  }
  char neg = 0;
  if (ed == '-') {
    neg = 1;
    ed = getchar();
  }
  while (isdigit(ed)) {
    a = 10 * a + ed - '0';
    ed = getchar();
  }
  if (neg) a = -a;
}
template <typename T = int>
inline T nxt() {
  T res;
  input(res);
  return res;
}
void myassert(bool v) { assert(v); }
mt19937 generator;
bool check(int v) {
  if (v < 2) return false;
  for (int i = 2; i * i <= v; ++i) {
    if (v % i == 0) {
      return false;
    }
  }
  return true;
}
long long pw(long long a, long long n, long long m) {
  long long res = 1;
  while (n) {
    if (n & 1ll) {
      res = res * a % m;
    }
    a = a * a % m;
    n >>= 1;
  }
  return res;
}
long long inv(long long a, long long p) {
  long long res = 1;
  while (a > 1) {
    res = res * (p - p / a) % p;
    a = p % a;
  }
  return res;
}
const int MAXN = 1000;
const int INF = 1000000000;
struct D {
  struct edge {
    int a, b, cap, flow;
  };
  int n, s, t, d[MAXN], ptr[MAXN], q[MAXN];
  vector<edge> e;
  vector<int> g[MAXN];
  void add_edge(int a, int b, int cap) {
    edge e1 = {a, b, cap, 0};
    edge e2 = {b, a, 0, 0};
    g[a].push_back((int)e.size());
    e.push_back(e1);
    g[b].push_back((int)e.size());
    e.push_back(e2);
  }
  bool bfs() {
    int qh = 0, qt = 0;
    q[qt++] = s;
    memset(d, -1, n * sizeof d[0]);
    d[s] = 0;
    while (qh < qt && d[t] == -1) {
      int v = q[qh++];
      for (size_t i = 0; i < g[v].size(); ++i) {
        int id = g[v][i], to = e[id].b;
        if (d[to] == -1 && e[id].flow < e[id].cap) {
          q[qt++] = to;
          d[to] = d[v] + 1;
        }
      }
    }
    return d[t] != -1;
  }
  int dfs(int v, int flow) {
    if (!flow) return 0;
    if (v == t) return flow;
    for (; ptr[v] < (int)g[v].size(); ++ptr[v]) {
      int id = g[v][ptr[v]], to = e[id].b;
      if (d[to] != d[v] + 1) continue;
      int pushed = dfs(to, min(flow, e[id].cap - e[id].flow));
      if (pushed) {
        e[id].flow += pushed;
        e[id ^ 1].flow -= pushed;
        return pushed;
      }
    }
    return 0;
  }
  int dinic() {
    int flow = 0;
    for (;;) {
      if (!bfs()) break;
      memset(ptr, 0, n * sizeof ptr[0]);
      while (int pushed = dfs(s, INF)) flow += pushed;
    }
    return flow;
  }
};
struct E {
  int u;
  int v;
  int c;
};
vector<E> e;
struct G {
  vector<int> g[MAXN];
  char used[MAXN];
  int ok[MAXN];
  int comp[MAXN];
  int timer, tin[MAXN], fup[MAXN];
  int n;
  void add_edge(int id) {
    g[e[id].u].push_back(2 * id);
    g[e[id].v].push_back(2 * id + 1);
  }
  void clear() {
    for (int i = 0; i < (int)(n); ++i) {
      g[i].clear();
    }
  }
  void dfs(int v, int p = -1) {
    used[v] = true;
    tin[v] = fup[v] = timer++;
    for (size_t i = 0; i < g[v].size(); ++i) {
      int eid = g[v][i];
      if (p != -1 && (eid ^ p) == 1) continue;
      int to = (eid & 1) ? e[eid >> 1].u : e[eid >> 1].v;
      if (used[to])
        fup[v] = min(fup[v], tin[to]);
      else {
        dfs(to, eid);
        fup[v] = min(fup[v], fup[to]);
      }
    }
  }
  int sz;
  int ans = INT_MAX;
  int ID;
  int s, t;
  bool dfs2(int v, int p, int c) {
    used[v] = true;
    comp[v] = c;
    bool res = v == t;
    for (size_t i = 0; i < g[v].size(); ++i) {
      int eid = g[v][i];
      if ((eid ^ p) == 1) continue;
      int to = (eid & 1) ? e[eid >> 1].u : e[eid >> 1].v;
      if (used[to]) {
        continue;
      } else {
        if (fup[to] > tin[v]) {
          if (dfs2(to, eid, sz++)) {
            if (e[eid >> 1].c < ans) {
              ans = e[eid >> 1].c;
              ID = eid >> 1;
            }
            res = true;
          }
        } else {
          if (dfs2(to, eid, c)) {
            res = true;
          }
        }
      }
    }
    return res;
  }
  int find_bridges() {
    timer = 0;
    for (int i = 0; i < n; ++i) used[i] = false;
    dfs(s, -1);
    sz = 0;
    ans = INT_MAX;
    for (int i = 0; i < n; ++i) used[i] = false;
    bool res = dfs2(s, -1, sz++);
    if (!res) return 0;
    if (comp[s] == comp[t]) {
      return INT_MAX;
    }
    return ans;
  }
};
void solve(int test) {
  int n = nxt();
  int m = nxt();
  int s = nxt() - 1;
  int t = nxt() - 1;
  for (int i = 0; i < (int)(m); ++i) {
    E z;
    z.u = nxt() - 1;
    z.v = nxt() - 1;
    z.c = nxt();
    e.push_back(z);
  }
  D d;
  d.n = n;
  d.s = s;
  d.t = t;
  for (int i = 0; i < m; ++i) {
    int c = 0;
    if (e[i].u != e[i].v) {
      c = 1;
    }
    d.add_edge(e[i].u, e[i].v, c);
    d.add_edge(e[i].v, e[i].u, c);
  }
  int f = d.dinic();
  if (f == 0) {
    cout << "0\n0\n";
    return;
  }
  if (f > 2) {
    cout << "-1\n";
    return;
  }
  vector<int> ids;
  for (int i = 0; i < 4 * m; i += 2) {
    if (d.e[i].flow > 0) {
      ids.push_back(i / 4);
    }
  }
  G g;
  g.n = n;
  g.s = s;
  g.t = t;
  int ans = INT_MAX;
  vector<int> I;
  for (int id : ids) {
    g.clear();
    for (int i = 0; i < m; ++i) {
      if (i != id) {
        g.add_edge(i);
      }
    }
    int res = g.find_bridges();
    if (res == INT_MAX) {
      continue;
    }
    if (res == 0) {
      if (e[id].c < ans) {
        ans = e[id].c;
        I.clear();
        I.push_back(id);
      }
    } else {
      if (g.ans + e[id].c < ans) {
        ans = g.ans + e[id].c;
        I.clear();
        I.push_back(id);
        I.push_back(g.ID);
      }
    }
  }
  cout << ans << "\n";
  cout << I.size() << "\n";
  for (int first : I) {
    cout << first + 1 << " ";
  }
  cout << "\n";
}
int main(int argc, char **argv) {
  int t = 1;
  int c = 0;
  while (t--) {
    solve(++c);
  }
  return 0;
}

### Prompt

Please create a solution in Cpp to the following problem:

Again, there are hard times in Berland! Many towns have such tensions that even civil war is possible. 

There are n towns in Reberland, some pairs of which connected by two-way roads. It is not guaranteed that it is possible to reach one town from any other town using these roads. 

Towns s and t announce the final break of any relationship and intend to rule out the possibility of moving between them by the roads. Now possibly it is needed to close several roads so that moving from s to t using roads becomes impossible. Each town agrees to spend money on closing no more than one road, therefore, the total number of closed roads will be no more than two.

Help them find set of no more than two roads such that there will be no way between s and t after closing these roads. For each road the budget required for its closure was estimated. Among all sets find such that the total budget for the closure of a set of roads is minimum.

Input

The first line of the input contains two integers n and m (2 ≤ n ≤ 1000, 0 ≤ m ≤ 30 000) — the number of towns in Berland and the number of roads.

The second line contains integers s and t (1 ≤ s, t ≤ n, s ≠ t) — indices of towns which break up the relationships.

Then follow m lines, each of them contains three integers xi, yi and wi (1 ≤ xi, yi ≤ n, 1 ≤ wi ≤ 109) — indices of towns connected by the i-th road, and the budget on its closure.

All roads are bidirectional. It is allowed that the pair of towns is connected by more than one road. Roads that connect the city to itself are allowed. 

Output

In the first line print the minimum budget required to break up the relations between s and t, if it is allowed to close no more than two roads.

In the second line print the value c (0 ≤ c ≤ 2) — the number of roads to be closed in the found solution.

In the third line print in any order c diverse integers from 1 to m — indices of closed roads. Consider that the roads are numbered from 1 to m in the order they appear in the input. 

If it is impossible to make towns s and t disconnected by removing no more than 2 roads, the output should contain a single line -1. 

If there are several possible answers, you may print any of them.

Examples

Input

6 7
1 6
2 1 6
2 3 5
3 4 9
4 6 4
4 6 5
4 5 1
3 1 3


Output

8
2
2 7


Input

6 7
1 6
2 3 1
1 2 2
1 3 3
4 5 4
3 6 5
4 6 6
1 5 7


Output

9
2
4 5


Input

5 4
1 5
2 1 3
3 2 1
3 4 4
4 5 2


Output

1
1
2


Input

2 3
1 2
1 2 734458840
1 2 817380027
1 2 304764803


Output

-1

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
template <typename T>
T gcd(T first, T second) {
  while (second > 0) {
    first %= second;
    swap(first, second);
  }
  return first;
}
template <class T>
T lcm(T a, T b) {
  return a / gcd(a, b) * b;
}
template <class _T>
inline _T sqr(const _T &first) {
  return first * first;
}
template <class _T>
inline string tostr(const _T &a) {
  ostringstream os("");
  os << a;
  return os.str();
}
const long double PI = 3.1415926535897932384626433832795L;
template <typename T>
inline void input(T &a) {
  static int ed;
  a = 0;
  while (!isdigit(ed = getchar()) && ed != '-') {
  }
  char neg = 0;
  if (ed == '-') {
    neg = 1;
    ed = getchar();
  }
  while (isdigit(ed)) {
    a = 10 * a + ed - '0';
    ed = getchar();
  }
  if (neg) a = -a;
}
template <typename T = int>
inline T nxt() {
  T res;
  input(res);
  return res;
}
void myassert(bool v) { assert(v); }
mt19937 generator;
bool check(int v) {
  if (v < 2) return false;
  for (int i = 2; i * i <= v; ++i) {
    if (v % i == 0) {
      return false;
    }
  }
  return true;
}
long long pw(long long a, long long n, long long m) {
  long long res = 1;
  while (n) {
    if (n & 1ll) {
      res = res * a % m;
    }
    a = a * a % m;
    n >>= 1;
  }
  return res;
}
long long inv(long long a, long long p) {
  long long res = 1;
  while (a > 1) {
    res = res * (p - p / a) % p;
    a = p % a;
  }
  return res;
}
const int MAXN = 1000;
const int INF = 1000000000;
struct D {
  struct edge {
    int a, b, cap, flow;
  };
  int n, s, t, d[MAXN], ptr[MAXN], q[MAXN];
  vector<edge> e;
  vector<int> g[MAXN];
  void add_edge(int a, int b, int cap) {
    edge e1 = {a, b, cap, 0};
    edge e2 = {b, a, 0, 0};
    g[a].push_back((int)e.size());
    e.push_back(e1);
    g[b].push_back((int)e.size());
    e.push_back(e2);
  }
  bool bfs() {
    int qh = 0, qt = 0;
    q[qt++] = s;
    memset(d, -1, n * sizeof d[0]);
    d[s] = 0;
    while (qh < qt && d[t] == -1) {
      int v = q[qh++];
      for (size_t i = 0; i < g[v].size(); ++i) {
        int id = g[v][i], to = e[id].b;
        if (d[to] == -1 && e[id].flow < e[id].cap) {
          q[qt++] = to;
          d[to] = d[v] + 1;
        }
      }
    }
    return d[t] != -1;
  }
  int dfs(int v, int flow) {
    if (!flow) return 0;
    if (v == t) return flow;
    for (; ptr[v] < (int)g[v].size(); ++ptr[v]) {
      int id = g[v][ptr[v]], to = e[id].b;
      if (d[to] != d[v] + 1) continue;
      int pushed = dfs(to, min(flow, e[id].cap - e[id].flow));
      if (pushed) {
        e[id].flow += pushed;
        e[id ^ 1].flow -= pushed;
        return pushed;
      }
    }
    return 0;
  }
  int dinic() {
    int flow = 0;
    for (;;) {
      if (!bfs()) break;
      memset(ptr, 0, n * sizeof ptr[0]);
      while (int pushed = dfs(s, INF)) flow += pushed;
    }
    return flow;
  }
};
struct E {
  int u;
  int v;
  int c;
};
vector<E> e;
struct G {
  vector<int> g[MAXN];
  char used[MAXN];
  int ok[MAXN];
  int comp[MAXN];
  int timer, tin[MAXN], fup[MAXN];
  int n;
  void add_edge(int id) {
    g[e[id].u].push_back(2 * id);
    g[e[id].v].push_back(2 * id + 1);
  }
  void clear() {
    for (int i = 0; i < (int)(n); ++i) {
      g[i].clear();
    }
  }
  void dfs(int v, int p = -1) {
    used[v] = true;
    tin[v] = fup[v] = timer++;
    for (size_t i = 0; i < g[v].size(); ++i) {
      int eid = g[v][i];
      if (p != -1 && (eid ^ p) == 1) continue;
      int to = (eid & 1) ? e[eid >> 1].u : e[eid >> 1].v;
      if (used[to])
        fup[v] = min(fup[v], tin[to]);
      else {
        dfs(to, eid);
        fup[v] = min(fup[v], fup[to]);
      }
    }
  }
  int sz;
  int ans = INT_MAX;
  int ID;
  int s, t;
  bool dfs2(int v, int p, int c) {
    used[v] = true;
    comp[v] = c;
    bool res = v == t;
    for (size_t i = 0; i < g[v].size(); ++i) {
      int eid = g[v][i];
      if ((eid ^ p) == 1) continue;
      int to = (eid & 1) ? e[eid >> 1].u : e[eid >> 1].v;
      if (used[to]) {
        continue;
      } else {
        if (fup[to] > tin[v]) {
          if (dfs2(to, eid, sz++)) {
            if (e[eid >> 1].c < ans) {
              ans = e[eid >> 1].c;
              ID = eid >> 1;
            }
            res = true;
          }
        } else {
          if (dfs2(to, eid, c)) {
            res = true;
          }
        }
      }
    }
    return res;
  }
  int find_bridges() {
    timer = 0;
    for (int i = 0; i < n; ++i) used[i] = false;
    dfs(s, -1);
    sz = 0;
    ans = INT_MAX;
    for (int i = 0; i < n; ++i) used[i] = false;
    bool res = dfs2(s, -1, sz++);
    if (!res) return 0;
    if (comp[s] == comp[t]) {
      return INT_MAX;
    }
    return ans;
  }
};
void solve(int test) {
  int n = nxt();
  int m = nxt();
  int s = nxt() - 1;
  int t = nxt() - 1;
  for (int i = 0; i < (int)(m); ++i) {
    E z;
    z.u = nxt() - 1;
    z.v = nxt() - 1;
    z.c = nxt();
    e.push_back(z);
  }
  D d;
  d.n = n;
  d.s = s;
  d.t = t;
  for (int i = 0; i < m; ++i) {
    int c = 0;
    if (e[i].u != e[i].v) {
      c = 1;
    }
    d.add_edge(e[i].u, e[i].v, c);
    d.add_edge(e[i].v, e[i].u, c);
  }
  int f = d.dinic();
  if (f == 0) {
    cout << "0\n0\n";
    return;
  }
  if (f > 2) {
    cout << "-1\n";
    return;
  }
  vector<int> ids;
  for (int i = 0; i < 4 * m; i += 2) {
    if (d.e[i].flow > 0) {
      ids.push_back(i / 4);
    }
  }
  G g;
  g.n = n;
  g.s = s;
  g.t = t;
  int ans = INT_MAX;
  vector<int> I;
  for (int id : ids) {
    g.clear();
    for (int i = 0; i < m; ++i) {
      if (i != id) {
        g.add_edge(i);
      }
    }
    int res = g.find_bridges();
    if (res == INT_MAX) {
      continue;
    }
    if (res == 0) {
      if (e[id].c < ans) {
        ans = e[id].c;
        I.clear();
        I.push_back(id);
      }
    } else {
      if (g.ans + e[id].c < ans) {
        ans = g.ans + e[id].c;
        I.clear();
        I.push_back(id);
        I.push_back(g.ID);
      }
    }
  }
  cout << ans << "\n";
  cout << I.size() << "\n";
  for (int first : I) {
    cout << first + 1 << " ";
  }
  cout << "\n";
}
int main(int argc, char **argv) {
  int t = 1;
  int c = 0;
  while (t--) {
    solve(++c);
  }
  return 0;
}

```