#include <bits/stdc++.h>
using namespace std;
const int N = 1010, M = 30010, inf = 2e9 + 1;
struct edge {
  int to, id;
};
int n, m, s, t, u, v, w, timer, cur, Min;
int was[N], c[M], tin[N], up[N];
vector<edge> g[N];
vector<int> path, br, ans;
bool dfs1(int v, int to) {
  was[v] = 1;
  if (v == to) return 1;
  for (auto e : g[v]) {
    if (!was[e.to] && dfs1(e.to, to)) {
      path.push_back(e.id);
      return 1;
    }
  }
  return 0;
}
bool dfs2(int v, int to, int p = -1) {
  was[v] = 1;
  tin[v] = up[v] = ++timer;
  bool res = v == to;
  for (auto e : g[v]) {
    if (e.id == cur || e.id == p) continue;
    if (was[e.to])
      up[v] = min(up[v], tin[e.to]);
    else {
      bool flag = dfs2(e.to, to, e.id);
      res = max(res, flag);
      up[v] = min(up[v], up[e.to]);
      if (up[e.to] == tin[e.to] && flag) br.push_back(e.id);
    }
  }
  return res;
}
bool rel(int &a, int b) {
  a = min(a, b);
  return a == b;
}
int main() {
  scanf("%d %d %d %d", &n, &m, &s, &t);
  for (int i = 1; i <= m; ++i) {
    scanf("%d %d %d", &u, &v, &w);
    g[u].push_back({v, i});
    g[v].push_back({u, i});
    c[i] = w;
  }
  if (!dfs1(s, t)) {
    printf("0\n0\n");
    return 0;
  }
  Min = inf;
  for (auto i : path) {
    cur = i;
    timer = 0;
    br.clear();
    memset(was, 0, sizeof(was));
    if (!dfs2(s, t))
      if (rel(Min, c[i])) ans = {i};
    for (auto i2 : br)
      if (rel(Min, c[i] + c[i2])) ans = {i, i2};
  }
  if (Min == inf) {
    printf("-1\n");
    return 0;
  }
  printf("%d\n%d\n", Min, (int)ans.size());
  for (auto i : ans) printf("%d ", i);
  return 0;
}
