#include <bits/stdc++.h>
using namespace std;
template <class T>
bool chkmin(T& a, T b) {
  return a > b ? a = b, true : false;
}
template <class T>
bool chkmax(T& a, T b) {
  return a < b ? a = b, true : false;
}
const int maxN = 1e5 + 5;
const int oo = 0x3f3f3f3f;
struct Edge {
  int v, w, next;
} G[maxN << 1];
struct EDGE {
  int u, v, w;
} ed[maxN];
int st[maxN], e = 1;
inline void addedge(int u, int v, int w) {
  G[++e] = (Edge){v, w, st[u]};
  st[u] = e;
}
int ban;
int N, M;
int S, T;
vector<int> lover;
bool vis[maxN];
namespace BCC {
int stk[maxN], tp, dfn[maxN], low[maxN], dfs_clock;
int val = +oo, ED = 0;
bool dfs(int u, int pre) {
  bool flag = false;
  if (u == T) flag = true;
  dfn[u] = low[u] = ++dfs_clock;
  for (int e = st[u]; e; e = G[e].next) {
    if (ban == e / 2 || pre == e || (pre ^ 1) == e) continue;
    int v = G[e].v;
    if (dfn[v] == 0) {
      if (dfs(v, e)) flag = true;
      chkmin(low[u], low[v]);
    } else
      chkmin(low[u], dfn[v]);
  }
  if (low[u] == dfn[u]) {
    if (pre != 0 && flag == true) {
      if (chkmin(val, ed[pre / 2].w)) ED = pre / 2;
    }
  }
  return flag;
}
int check() {
  tp = 0;
  memset(dfn, 0, sizeof(dfn));
  memset(low, 0, sizeof(low));
  dfs_clock = 0;
  val = +oo, ED = 0;
  bool flag = dfs(S, 0);
  if (flag == false) return 0;
  return val == +oo ? val : ED;
}
}  // namespace BCC
void init() {
  scanf("%d%d%d%d", &N, &M, &S, &T);
  for (int i = (1), _ = (M); i <= _; ++i) {
    int u, v, w;
    scanf("%d%d%d", &u, &v, &w);
    addedge(u, v, w), addedge(v, u, w);
    ed[i] = (EDGE){u, v, w};
  }
}
bool DFS(int u, int fr) {
  if (u == T) return true;
  bool ret = false;
  for (int e = st[u]; e; e = G[e].next) {
    int v = G[e].v;
    if (vis[v] == false) {
      vis[v] = true;
      if (DFS(v, u)) {
        lover.push_back(e / 2);
        ret = true;
      }
    }
  }
  return ret;
}
void solve() {
  vis[S] = true;
  DFS(S, 0);
  if (lover.size() == 0) {
    printf("0\n0\n");
    return;
  }
  int ans = 2e9 + 1, tot = 1, a[2] = {0, 0};
  for (int i = (0), _ = (lover.size() - 1); i <= _; ++i) {
    ban = lover[i];
    int ret = BCC::check();
    if (ret == +oo) continue;
    if (ret == 0) {
      if (chkmin(ans, ed[ban].w)) {
        a[0] = ban, tot = 1;
      }
      continue;
    }
    if (chkmin(ans, ed[ret].w + ed[ban].w)) {
      a[0] = ban, a[1] = ret, tot = 2;
    }
  }
  if (ans > 2e9) {
    puts("-1");
    return;
  }
  printf("%d\n%d\n", ans, tot);
  for (int i = (0), _ = (tot - 1); i <= _; ++i) printf("%d ", a[i]);
  puts("");
}
int main() {
  init();
  solve();
  return 0;
}
