#include <bits/stdc++.h>
using namespace std;
const int N = 1001, M = 60003;
bool brd[M];
int i, j, k, n, m, t, c, D, P1, P2 = 30001, pe[N], pv[N], PE[N], PV[N];
int S, E, en[M], nxt[M], w[M], fa[N], dfn[N], low[N];
void dfs(int u) {
  int i = fa[u], v;
  for (low[u] = dfn[u] = ++t; i; i = nxt[i])
    if (i + 1 >> 1 != D)
      if (!dfn[v = en[i]]) {
        pv[v] = u, pe[v] = i + 1 >> 1, dfs(v);
        low[u] = min(low[u], low[v]);
      } else if (i + 1 >> 1 != pe[u])
        low[u] = min(low[u], dfn[v]);
  if (pe[u] && low[u] == dfn[u]) brd[pe[u]] = 1;
}
int main() {
  scanf("%d%d", &n, &m), *w = 21e8;
  for (scanf("%d%d", &S, &E); m--;) {
    scanf("%d%d%d", &i, &j, &k);
    en[++t] = j, nxt[t] = fa[i], fa[i] = t, w[t] = k;
    en[++t] = i, nxt[t] = fa[j], fa[j] = t, w[t] = k;
  }
  if (dfs(S), !dfn[E]) return puts("0\n0"), 0;
  for (k = E; k != S; k = pv[k]) {
    if (!brd[pe[k]]) continue;
    if (c = 1, w[pe[k] << 1] < w[P1 << 1]) P1 = pe[k];
  }
  memcpy(PE + 1, pe + 1, 4 * n);
  memcpy(PV + 1, pv + 1, 4 * n);
  for (j = E; j != S; j = PV[j]) {
    memset(dfn + 1, 0, 4 * n);
    memset(brd, 0, M);
    D = PE[j], dfs(S);
    if (!dfn[E]) continue;
    for (k = E; k != S; k = pv[k]) {
      if (!brd[pe[k]]) continue;
      if (w[D << 1] + w[pe[k] << 1] < w[P1 << 1] + w[P2 << 1])
        c = 2, P1 = D, P2 = pe[k];
    }
  }
  if (!P1) return puts("-1"), 0;
  printf("%d\n%d\n%d", w[P1 << 1] + w[P2 << 1], c, P1);
  if (c > 1) printf(" %d", P2);
}
