#include <bits/stdc++.h>
using namespace std;
struct aa {
  int to, next, val;
} a[30010 * 2];
struct AA {
  int to, next, val, i;
} A[30010 * 2];
struct ee {
  int x, y, val;
} edge[30010];
int number[30010 * 2];
int head[1010], Head[1010], belong[1010], st[1010], vis[1010], low[1010],
    dfn[1010], b[1010], c[1010];
int Cnt, cnt, S, T, block, top, num, Num, NUM, n, m, ans, i, j, x, y, z, ans1,
    ans2, Min, Mini;
int hhh[1010][1010];
bool ff;
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch <= '9' && ch >= '0') x = x * 10 + ch - '0', ch = getchar();
  return x * f;
}
inline void write(int x) {
  if (x < 0) putchar('-'), x = -x;
  if (x >= 10) write(x / 10);
  putchar(x % 10 + '0');
}
inline void add(int x, int y, int z) {
  num++;
  a[num].next = head[x];
  a[num].to = y;
  a[num].val = z;
  head[x] = num;
}
inline void Add(int x, int y, int z, int i) {
  NUM++;
  A[NUM].next = Head[x];
  A[NUM].to = y;
  A[NUM].val = z;
  A[NUM].i = i;
  Head[x] = NUM;
}
inline void tarjan(int x, int fa, int fuck) {
  int i, y;
  vis[x] = 1;
  top++;
  st[top] = x;
  Num++;
  low[x] = dfn[x] = Num;
  for (i = head[x]; i; i = a[i].next) {
    if (i == fa || (i ^ 1) == fa || i == fuck || (i ^ 1) == fuck) continue;
    y = a[i].to;
    if (!dfn[y]) {
      tarjan(y, i, fuck);
      low[x] = min(low[x], low[y]);
    } else if (vis[y])
      low[x] = min(low[x], dfn[y]);
  }
  if (low[x] == dfn[x]) {
    block++;
    while (1) {
      y = st[top];
      top--;
      belong[y] = block;
      vis[y] = 0;
      if (x == y) break;
    }
  }
}
inline void rebuild(int x) {
  int i, j, y;
  for (i = 1; i <= n; i++)
    for (j = head[i]; j; j = a[j].next) {
      y = a[j].to;
      if (j == x || (j ^ 1) == x) continue;
      if (belong[y] == belong[i]) continue;
      Add(belong[i], belong[y], a[j].val, j);
      hhh[belong[i]][belong[y]]++;
    }
}
inline void getmin(int x, int fa) {
  int i, y;
  if (ff) return;
  if (x == belong[T]) {
    ff = 1;
    return;
  }
  for (i = Head[x]; i; i = A[i].next) {
    y = A[i].to;
    if (y == fa) continue;
    if (hhh[x][y] > 1) continue;
    Cnt++;
    c[Cnt] = A[i].i;
    getmin(y, x);
    if (ff) return;
    Cnt--;
  }
}
inline void dfs(int x) {
  int i, y;
  vis[x] = 1;
  if (x == T) {
    ff = 1;
    return;
  }
  if (ff) return;
  for (i = head[x]; i; i = a[i].next) {
    y = a[i].to;
    if (vis[y]) continue;
    cnt++;
    b[cnt] = i;
    dfs(y);
    if (ff) return;
    cnt--;
  }
}
int main() {
  n = read();
  m = read();
  S = read();
  T = read();
  num = 1;
  for (i = 1; i <= m; i++) {
    x = edge[i].x = read();
    y = edge[i].y = read();
    z = edge[i].val = read();
    add(x, y, z);
    number[num] = i;
    add(y, x, z);
    number[num] = i;
  }
  ans = 2000000010;
  ff = 0;
  dfs(S);
  if (!ff) {
    puts("0");
    puts("0");
    return 0;
  }
  memset(vis, 0, sizeof(vis));
  for (i = 1; i <= cnt; i++) {
    memset(dfn, 0, sizeof(dfn));
    memset(low, 0, sizeof(low));
    memset(belong, 0, sizeof(belong));
    Num = 0;
    block = 0;
    tarjan(S, -1, b[i]);
    if (!dfn[T]) {
      if (ans <= a[b[i]].val) continue;
      ans = a[b[i]].val;
      ans1 = number[b[i]];
      ans2 = 0;
      continue;
    }
    if (belong[S] == belong[T]) continue;
    memset(Head, 0, sizeof(Head));
    NUM = 0;
    Cnt = 0;
    memset(hhh, 0, sizeof(hhh));
    rebuild(b[i]);
    ff = 0;
    getmin(belong[S], -1);
    Min = 2000000010;
    for (j = 1; j <= Cnt; j++) {
      if (Min <= a[c[j]].val) continue;
      Min = a[c[j]].val;
      Mini = number[c[j]];
    }
    if (Min + a[b[i]].val >= ans) continue;
    ans = Min + a[b[i]].val;
    ans1 = number[b[i]];
    ans2 = Mini;
  }
  if (ans == 2000000010) {
    puts("-1");
    return 0;
  }
  write(ans);
  puts("");
  if (!ans2) {
    puts("1");
    write(ans1);
    return 0;
  }
  puts("2");
  write(ans1);
  putchar(' ');
  write(ans2);
}
