#include <bits/stdc++.h>
using namespace std;
const int N = 1003, M = 30003;
int go[M * 2], t[M * 2], last[N], Val[M];
int dfn[N], low[N], pre[N], g[N];
int n, m, en, st, ed, Dn, ls, Ans, Ansx, Ansy;
bool vis[N], use[M * 2];
void add(int u, int v) {
  go[++en] = v;
  t[en] = last[u];
  last[u] = en;
}
void Tarjan(int w) {
  dfn[w] = low[w] = ++Dn;
  for (int i = last[w]; i; i = t[i])
    if (!use[i]) {
      int to = go[i];
      if (dfn[to]) {
        low[w] = min(low[w], dfn[to]);
      } else {
        pre[to] = i;
        use[i] = use[i ^ 1] = 1;
        Tarjan(to);
        low[w] = min(low[w], low[to]);
        use[i] = use[i ^ 1] = 0;
      }
    }
}
int main() {
  scanf("%d%d", &n, &m);
  scanf("%d%d", &st, &ed);
  en = 1;
  for (int i = 1; i <= m; i++) {
    int u, v;
    scanf("%d%d%d", &u, &v, &Val[i]);
    add(u, v);
    add(v, u);
  }
  Tarjan(st);
  if (!dfn[ed]) {
    puts("0");
    puts("0");
    return 0;
  }
  Ans = 2147483647;
  for (int w = ed; w != st; w = go[pre[w] ^ 1]) {
    int i = pre[w];
    int u = go[i ^ 1];
    if (dfn[u] < low[w]) {
      if (Val[i / 2] < Ans) {
        Ans = Val[i / 2];
        Ansx = i / 2;
      }
    } else
      g[++ls] = i;
  }
  for (int i = 1; i <= ls; i++) {
    Dn = 0;
    for (int j = 1; j <= n; j++) dfn[j] = 0;
    use[g[i]] = use[g[i] ^ 1] = 1;
    Tarjan(st);
    for (int w = ed; w != st; w = go[pre[w] ^ 1]) {
      int j = pre[w];
      int u = go[j ^ 1];
      if (dfn[u] < low[w]) {
        if (Val[g[i] / 2] + Val[j / 2] < Ans) {
          Ans = Val[g[i] / 2] + Val[j / 2];
          Ansx = g[i] / 2;
          Ansy = j / 2;
        }
      }
    }
    use[g[i]] = use[g[i] ^ 1] = 0;
  }
  if (Ans == 2147483647) {
    puts("-1");
    return 0;
  }
  printf("%d\n", Ans);
  if (Ansy)
    printf("2\n%d %d", Ansx, Ansy);
  else
    printf("1\n%d", Ansx);
}
