#include <bits/stdc++.h>
using namespace std;
const int maxn = 1010, maxm = 60010, inf = 0x7fffffff;
int n, m, s, t, head[maxn], to[maxm], nextt[maxm], w[maxm], tot = 1;
int pre[maxn], low[maxn], dfs_clock, vis[maxn], path[maxn], cnt, top;
struct node {
  int p1, p2, sum;
} ans[maxm];
void add(int x, int y, int z) {
  w[++tot] = z;
  to[tot] = y;
  nextt[tot] = head[x];
  head[x] = tot;
}
bool dfs(int u) {
  vis[u] = 1;
  if (u == t) return true;
  for (int i = head[u]; i; i = nextt[i]) {
    int v = to[i];
    if (vis[v]) continue;
    if (dfs(v)) {
      path[++cnt] = i;
      return true;
    }
  }
  return false;
}
bool cmp(node a, node b) { return a.sum < b.sum; }
void tarjan(int u, int p1, int p2, int p) {
  pre[u] = low[u] = ++dfs_clock;
  for (int i = head[u]; i; i = nextt[i]) {
    int v = to[i];
    if (i == p1 || i == p2 || i == (p ^ 1)) continue;
    if (!pre[v]) {
      tarjan(v, p1, p2, i);
      low[u] = min(low[u], low[v]);
      if (low[v] > pre[u] && (pre[v] <= pre[t])) {
        if (ans[top].p2) {
          if (w[ans[top].p2] > w[i]) {
            ans[top].sum -= w[ans[top].p2];
            ans[top].p2 = i;
            ans[top].sum += w[i];
          }
        } else {
          ans[top].p2 = i;
          ans[top].sum += w[i];
        }
      }
    } else
      low[u] = min(low[u], pre[v]);
  }
}
int main() {
  scanf("%d%d%d%d", &n, &m, &s, &t);
  for (int i = 1; i <= m; i++) {
    int x, y, z;
    scanf("%d%d%d", &x, &y, &z);
    add(x, y, z);
    add(y, x, z);
  }
  dfs(s);
  if (!cnt)
    printf("%d\n%d\n", 0, 0);
  else {
    for (int i = 1; i <= cnt; i++) {
      memset(pre, 0, sizeof(pre));
      memset(low, 0, sizeof(low));
      dfs_clock = 0;
      ans[++top].p1 = path[i] / 2;
      ans[top].sum = w[path[i]];
      tarjan(s, path[i], path[i] ^ 1, 0);
      if (pre[t] && !ans[top].p2) ans[top].sum = inf;
    }
    sort(ans + 1, ans + 1 + top, cmp);
    if (ans[1].sum == inf)
      puts("-1");
    else {
      printf("%d\n", ans[1].sum);
      if (ans[1].p2) {
        printf("%d\n", 2);
        printf("%d %d\n", ans[1].p1, ans[1].p2 / 2);
      } else {
        printf("%d\n", 1);
        printf("%d\n", ans[1].p1);
      }
    }
  }
  return 0;
}
