#include <bits/stdc++.h>
using namespace std;
template <class T, class L>
bool smax(T &x, L y) {
  return x < y ? (x = y, 1) : 0;
}
template <class T, class L>
bool smin(T &x, L y) {
  return y < x ? (x = y, 1) : 0;
}
const long long inf = 1e17;
const int maxn = 1e3 + 17, maxm = 1e5;
int n, m, ptr[maxn], head[maxn], prv[maxm], to[maxm], d[maxn], q[maxn], so,
    sink, ecnt, hi[maxn], h[maxn];
long long cap[maxm];
bool mark[maxn];
void add(int v, int u, long long vu) {
  long long uv = vu;
  to[ecnt] = u, prv[ecnt] = head[v], cap[ecnt] = vu, head[v] = ecnt++;
  to[ecnt] = v, prv[ecnt] = head[u], cap[ecnt] = uv, head[u] = ecnt++;
}
bool bfs() {
  int h = 0, t = 1;
  memset(d, 63, sizeof d);
  d[so] = 0;
  q[0] = so;
  while (h != t) {
    int v = q[h++];
    for (int e = head[v]; ~e; e = prv[e])
      if (cap[e] && d[to[e]] > d[v] + 1) d[to[e]] = d[v] + 1, q[t++] = to[e];
  }
  return d[sink] < n;
}
long long dfs(int v, long long flow = inf) {
  if (v == sink || !flow) return flow;
  long long ans = 0;
  for (; ~ptr[v]; ptr[v] = prv[ptr[v]]) {
    if (d[v] != d[to[ptr[v]]] - 1) continue;
    long long x = dfs(to[ptr[v]], min(flow, cap[ptr[v]]));
    flow -= x;
    ans += x;
    cap[ptr[v]] -= x;
    cap[ptr[v] ^ 1] += x;
    if (!flow) break;
  }
  return ans;
}
long long maxflow() {
  long long ans = 0;
  while (bfs()) {
    memcpy(ptr, head, sizeof head);
    ans += dfs(so);
  }
  return ans;
}
void visit(int v = so) {
  mark[v] = 1;
  for (int e = head[v]; ~e; e = prv[e])
    if (cap[e] && !mark[to[e]]) visit(to[e]);
}
vector<int> mincut() {
  memset(mark, 0, sizeof mark);
  visit();
  vector<int> ret;
  for (int i = 0; i < ecnt; i += 2)
    if (mark[to[i]] != mark[to[i ^ 1]]) ret.push_back(i >> 1);
  return ret;
}
void del_cut(int v = so, int p = -1) {
  mark[v] = 1;
  hi[v] = h[v];
  int cp = 0;
  for (int e = head[v]; ~e; e = prv[e])
    if (!mark[to[e]]) {
      h[to[e]] = h[v] + 1;
      del_cut(to[e], v);
      if (hi[to[e]] == h[to[e]]) cap[e] = cap[e ^ 1] = inf * 5;
      smin(hi[v], hi[to[e]]);
    } else if (to[e] != p)
      smin(hi[v], h[to[e]]);
    else
      cp++;
  if (cp > 1) smin(hi[v], h[v] - 1);
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0);
  memset(head, -1, sizeof head);
  cin >> n >> m >> so >> sink, so--, sink--;
  for (int v, u, w; m--;) {
    cin >> v >> u >> w, v--, u--;
    add(v, u, inf + w);
  }
  long long fir = maxflow();
  if (fir == 0) return cout << "0\n0\n", 0;
  vector<int> cut = mincut();
  if (cut.size() == 2)
    return cout << fir - 2 * inf << "\n2\n"
                << cut[0] + 1 << ' ' << cut[1] + 1 << '\n',
           0;
  if (cut.size() > 2) return cout << "-1\n", 0;
  int fir_cer = cut[0];
  memset(mark, 0, sizeof mark);
  del_cut();
  for (int e = 0; e < ecnt; e += 2)
    cap[e] = cap[e ^ 1] = (cap[e] + cap[e ^ 1]) / 2;
  long long sec = maxflow();
  cut = mincut();
  if (cut.size() > 2 || sec - 2 * inf >= fir - inf)
    return cout << fir - inf << "\n1\n" << fir_cer + 1 << '\n', 0;
  cout << sec - 2 * inf << "\n2\n" << cut[0] + 1 << ' ' << cut[1] + 1 << '\n';
  return 0;
}
