#include <bits/stdc++.h>
using namespace std;
const int N = 1200, M = 70000;
int E[M], X[M], O[M], R[N], D[N], L[N], g[N], h[N], o[N], x[M], y[M], z[M];
bool is[M], W[M];
int i, j, m, n, p, q, t, u, v, H, T, sum_E, D_C;
inline void addE(int x, int y, int z) {
  sum_E++, E[sum_E] = y, O[sum_E] = z, X[sum_E] = R[x], R[x] = sum_E;
}
inline void bfs() {
  memset(h, 0, sizeof(h)), memset(o, 0, sizeof(o));
  T = 1, g[T] = u, h[g[T]] = 1, o[g[T]] = 0;
  for (H = 1; H <= T; H++) {
    for (j = R[g[H]]; j != 0; j = X[j])
      if (!h[E[j]]) T++, g[T] = E[j], h[g[T]] = h[g[H]] + 1, o[g[T]] = j;
  }
  if (!h[v]) {
    printf("0\n0\n");
    exit(0);
  } else
    for (i = v; i != 0; i = E[((o[i] - 1) ^ 1) + 1]) W[(o[i] + 1) / 2] = true;
}
inline bool tarjan(int x, int y) {
  bool b = (x == v), c;
  D_C++, D[x] = L[x] = D_C;
  for (int i = R[x]; i != 0; i = X[i])
    if (!D[E[i]]) {
      c = tarjan(E[i], i), b = b | c, L[x] = min(L[x], L[E[i]]);
    } else if (O[i] != O[y])
      L[x] = min(L[x], D[E[i]]);
  if ((L[x] == D[x]) && (b) && (y)) is[O[y]] = true;
  return b;
}
inline void calc() {
  memset(D, 0, sizeof(D)), memset(is, false, sizeof(is));
  D_C = 0;
  tarjan(u, 0);
}
int main() {
  scanf("%d%d%d%d", &n, &m, &u, &v);
  for (i = 1; i <= m; i++)
    scanf("%d%d%d", &x[i], &y[i], &z[i]), addE(x[i], y[i], i),
        addE(y[i], x[i], i);
  calc();
  for (i = 1; i <= m; i++)
    if ((is[i]) && ((!t) || (z[t] > z[i]))) t = i;
  bfs();
  for (i = 1; i <= m; i++)
    if (W[i]) {
      memset(R, 0, sizeof(R));
      sum_E = 0;
      for (j = 1; j <= m; j++)
        if (i != j) addE(x[j], y[j], j), addE(y[j], x[j], j);
      calc();
      for (j = 1; j <= m; j++)
        if ((is[j]) && ((!(p | q)) || (z[p] + z[q] > z[i] + z[j])))
          p = i, q = j;
    }
  if ((t) && (p | q) && (z[p] + z[q] < z[t])) t = 0;
  if (t)
    printf("%d\n1\n%d\n", z[t], t);
  else if (p | q)
    printf("%d\n2\n%d %d\n", z[p] + z[q], p, q);
  else
    printf("-1");
}
