#include <bits/stdc++.h>
using namespace std;
const long long N = 2e5 + 10, MOD = 1e9 + 7, inf = 0x3f3f3f3f,
                INF = 0x3f3f3f3f3f3f3f3fll;
vector<pair<long long, long long>> G[N << 1];
long long dfn[N], low[N], cut[N], dsz;
long long s, t, n, m, cnt, ans;
long long vis[N], edge[N], w[N], ID[3];
vector<long long> g;
bool path(long long u) {
  if (u == t) return true;
  vis[u] = 1;
  for (auto it : G[u]) {
    long long v = it.first, id = it.second;
    if (!vis[v] && path(v)) {
      edge[++cnt] = id;
      return true;
    }
  }
  return false;
}
bool dfs(long long u, long long del) {
  if (u == t) return true;
  vis[u] = 1;
  for (auto it : G[u]) {
    long long v = it.first, id = it.second;
    if (id != del && !vis[v] && dfs(v, del)) {
      g.push_back(id);
      return true;
    }
  }
  return false;
}
void tarjan(long long u, long long fa, long long del) {
  dfn[u] = low[u] = ++dsz;
  for (auto it : G[u]) {
    long long v = it.first, id = it.second;
    if (id == fa || id == del) continue;
    if (!dfn[v]) {
      tarjan(v, id, del);
      low[u] = min(low[u], low[v]);
      if (low[v] > dfn[u]) cut[id] = 1;
    } else
      low[u] = min(low[u], dfn[v]);
  }
}
signed main() {
  ios::sync_with_stdio(false);
  cin >> n >> m >> s >> t;
  for (long long i = 1; i <= m; i++) {
    long long u, v;
    cin >> u >> v >> w[i];
    G[u].push_back({v, i}), G[v].push_back({u, i});
  }
  if (!path(s)) return cout << "0\n0\n", 0;
  ans = INF;
  for (long long i = 1; i <= cnt; i++) {
    long long id = edge[i];
    memset(vis, 0, sizeof(vis));
    g.clear();
    if (!dfs(s, id)) {
      if (w[id] < ans) ans = w[id], ID[1] = id, ID[2] = 0;
    } else {
      dsz = 0;
      memset(dfn, 0, sizeof(dfn));
      memset(low, 0, sizeof(low));
      memset(cut, 0, sizeof(cut));
      tarjan(s, 0, id);
      for (auto it : g) {
        if (cut[it] && w[it] + w[id] < ans)
          ans = w[it] + w[id], ID[1] = id, ID[2] = it;
      }
    }
  }
  if (ans == INF)
    cout << -1 << '\n';
  else {
    cout << ans << '\n';
    if (!ID[2])
      cout << "1\n" << ID[1] << '\n';
    else
      cout << "2\n" << ID[1] << " " << ID[2] << '\n';
  }
  return 0;
}
