#include <bits/stdc++.h>
const bool DEBUG = false;
using namespace std;
const long long maxn = 2e5 + 5;
const long long INF = 2e18;
const long long M = 1e9 + 7;
const int lg = 21;
long long n, m, s, t, rem1, rem2, ans, hazf_shode, id[maxn], wp[maxn], p[maxn],
    mn[maxn], h[maxn];
bool mark[maxn], peida_shod, hazf_shod;
vector<pair<pair<long long, long long>, long long> > candid;
pair<pair<long long, long long>, long long> dota;
vector<pair<pair<long long, long long>, pair<long long, long long> > > rem;
vector<pair<pair<long long, long long>, long long> > g[maxn];
pair<long long, long long> yeki;
bool check(int x, int y) {
  if (x == rem1 and y == rem2) return 1;
  if (x == rem2 and y == rem1) return 1;
  return 0;
}
void dfs1(int v) {
  mark[v] = 1;
  if (peida_shod) return;
  if (v == t) {
    while (v != s) {
      rem.push_back({{v, p[v]}, {wp[v], id[v]}});
      v = p[v];
    }
    peida_shod = 1;
  }
  if (peida_shod) return;
  for (auto u : g[v])
    if (!mark[u.first.first])
      id[u.first.first] = u.second, wp[u.first.first] = u.first.second,
      p[u.first.first] = v, dfs1(u.first.first);
}
void dfs2(int v, int idbabash = -1) {
  mark[v] = 1;
  for (auto U : g[v]) {
    auto u = U.first.first;
    if (U.second != hazf_shode and !mark[u]) {
      h[u] = h[v] + 1;
      p[u] = v;
      wp[u] = U.first.second;
      id[u] = U.second;
      dfs2(u, U.second);
      mn[v] = min(mn[v], mn[u]);
    } else if (mark[u] and U.second != hazf_shode and U.second != idbabash) {
      mn[v] = min(mn[v], h[u]);
    }
  }
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  ans = INF;
  cin >> n >> m;
  cin >> s >> t, s--, t--;
  for (int i = 0; i < m; i++) {
    int x, y, w;
    cin >> x >> y >> w, x--, y--;
    g[x].push_back({{y, w}, i});
    g[y].push_back({{x, w}, i});
  }
  dfs1(s);
  if (!mark[t]) return cout << 0 << endl << 0 << endl, 0;
  fill(mn, mn + maxn, INF);
  fill(p, p + maxn, 0);
  fill(h, h + maxn, 0);
  fill(wp, wp + maxn, 0);
  fill(id, id + maxn, 0);
  fill(mark, mark + maxn, 0);
  for (auto u : rem) {
    long long minn = INF;
    rem1 = u.first.first;
    rem2 = u.first.second;
    hazf_shode = u.second.second;
    dfs2(s);
    if (!mark[t]) {
      if (u.second.first < ans)
        ans = u.second.first, yeki = {u.second.second, ans};
    } else {
      long long t1 = t, ID;
      while (t1 != s) {
        long long par = p[t1];
        if (mn[t1] > h[par]) {
          if (minn > wp[t1]) minn = wp[t1], ID = id[t1];
        }
        t1 = par;
      }
      if (minn + u.second.first < ans)
        ans = minn + u.second.first, dota = {{ID, u.second.second}, ans};
    }
    fill(mn, mn + maxn, INF);
    fill(p, p + maxn, 0);
    fill(h, h + maxn, 0);
    fill(wp, wp + maxn, 0);
    fill(id, id + maxn, 0);
    fill(mark, mark + maxn, 0);
  }
  if (ans == INF) return cout << -1 << endl, 0;
  if (yeki.second == ans)
    return cout << ans << endl << 1 << endl << yeki.first + 1 << endl, 0;
  cout << ans << endl
       << 2 << endl
       << dota.first.first + 1 << " " << dota.first.second + 1 << endl;
  return 0;
}
