#include <bits/stdc++.h>
using namespace std;
struct EDGE {
  int from, to, w;
  EDGE() {}
  EDGE(int a, int b, int c) : from(a), to(b), w(c) {}
} e[100005];
vector<int> g[100005];
int vis[100005], path_pre[100005], cnt, ans, path[100005], pre[100005],
    dfs_clock, is_bridge[100005], p[3], low[100005];
int dfs1(int u, int fa) {
  vis[u] = 1;
  for (int i = 0; i < g[u].size(); i++) {
    int k = g[u][i];
    int v = e[k].to;
    if (!vis[v]) dfs1(v, u), path_pre[v] = k;
  }
  return 0;
}
int find_path(int st, int ed) {
  int l = 0;
  while (e[path_pre[ed]].from != st)
    path[++l] = path_pre[ed], ed = e[path_pre[ed]].from;
  path[++l] = path_pre[ed];
  return l;
}
int dfs2(int u, int fa, int num, int ed, int co) {
  int lowu = pre[u] = ++dfs_clock;
  for (int i = 0; i < g[u].size(); i++) {
    int k = g[u][i];
    int t = (k + 1) / 2;
    int tmp = (num + 1) / 2;
    if (k == 2 * tmp - 1 || k == 2 * tmp) continue;
    int v = e[k].to;
    if (!pre[v]) {
      int lowv = dfs2(v, k, num, ed, co);
      lowu = min(lowu, lowv);
      if (lowv > pre[u]) {
        is_bridge[k] = 1;
        if (pre[ed] >= pre[v]) {
          if (e[k].w + co < ans) {
            ans = e[k].w + co;
            cnt = 2;
            p[1] = (num + 1) / 2, p[2] = (k + 1) / 2;
          }
        }
      }
    } else if (pre[v] < pre[u] && fa != 2 * t - 1 && 2 * t != fa)
      lowu = min(lowu, pre[v]);
  }
  low[u] = lowu;
  return lowu;
}
int main() {
  int n, m, s, t;
  cin >> n >> m >> s >> t;
  for (int i = (1); i <= (m); i++) {
    int x, y, w;
    scanf("%d%d%d", &x, &y, &w);
    e[2 * i - 1] = EDGE(x, y, w), g[x].push_back(2 * i - 1);
    e[2 * i] = EDGE(y, x, w), g[y].push_back(2 * i);
  }
  memset(path_pre, 0, sizeof(path_pre));
  memset(vis, 0, sizeof(vis));
  memset(low, 0, sizeof(low));
  memset(pre, 0, sizeof(pre));
  path_pre[s] = -1;
  dfs1(s, -1);
  cnt = 0;
  if (!vis[t]) {
    printf("0\n0\n\n");
    return 0;
  }
  ans = 0x7fffffff;
  int len = find_path(s, t), p1, p2;
  for (int i = len; i >= 1; i--) {
    dfs_clock = 0;
    memset(pre, 0, sizeof(pre));
    memset(is_bridge, 0, sizeof(is_bridge));
    dfs2(s, -1, path[i], t, e[path[i]].w);
    if (!pre[t]) {
      if (e[path[i]].w < ans) {
        ans = e[path[i]].w;
        cnt = 1;
        p[1] = (path[i] + 1) / 2;
      }
    }
  }
  if (ans == 0x7fffffff)
    printf("-1\n");
  else {
    printf("%d\n%d\n", ans, cnt);
    printf("%d", p[1]);
    for (int i = (2); i <= (cnt); i++) printf(" %d", p[2]);
    printf("\n");
  }
}
