#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 2e5 + 47, inf = 1e17 + 47;
struct edg {
  long long p2, wt, ind;
  edg(long long a, long long b, long long c) { p2 = a, wt = b, ind = c; }
};
long long n, m, s, t;
vector<vector<edg> > graf(MAXN);
void read() {
  cin >> n >> m;
  cin >> s >> t;
  --s, --t;
  for (long long i = 0; i < m; i++) {
    long long a, b, w;
    cin >> a >> b >> w;
    --a, --b;
    graf[a].push_back(edg(b, w, i));
    graf[b].push_back(edg(a, w, i));
  }
}
vector<edg> vr;
vector<long long> used(MAXN);
bool bld = false;
void dfs(long long p1) {
  used[p1] = 1;
  if (p1 == t) bld = true;
  for (edg p : graf[p1]) {
    if (used[p.p2]) continue;
    if (!bld) vr.push_back(p);
    if (!bld) dfs(p.p2);
    if (!bld) vr.pop_back();
  }
}
vector<long long> tin(MAXN, 0), fup(MAXN, 0);
long long blok, tim = 0;
set<long long> brid;
void fnd_brid(long long p1, long long ind) {
  used[p1] = true;
  tin[p1] = fup[p1] = tim, tim++;
  for (edg p : graf[p1]) {
    if (p.ind == ind || p.ind == blok) continue;
    long long p2 = p.p2;
    if (used[p2]) {
      fup[p1] = min(fup[p1], tin[p2]);
    } else {
      fnd_brid(p2, p.ind);
      fup[p1] = min(fup[p1], fup[p2]);
      if (tin[p1] < fup[p2]) {
        brid.insert(p.ind);
      }
    }
  }
}
long long temp = inf, ti = -1;
bool get_ans(long long p1, long long ind) {
  used[p1] = true;
  if (p1 == t) return true;
  for (edg p : graf[p1]) {
    if (p.ind == ind || p.ind == blok || used[p.p2]) continue;
    long long p2 = p.p2;
    if (get_ans(p2, p.ind)) {
      if (brid.count(p.ind) == 1) {
        if (p.wt < temp) {
          temp = p.wt;
          ti = p.ind;
        }
      }
      return true;
    }
  }
  return false;
}
long long ans = inf;
pair<long long, long long> xy = {-1, -1};
void solve() {
  dfs(s);
  if ((long long)(vr.size()) == 0 || vr.back().p2 != t) {
    cout << 0 << "\n" << 0 << "\n";
    return;
  }
  for (edg p : vr) {
    blok = p.ind;
    tin.assign(n, 0), fup.assign(n, 0);
    tim = 1;
    used.assign(n, false), brid.clear();
    fnd_brid(s, -1);
    if (!used[t]) {
      if (ans > p.wt) {
        ans = p.wt;
        xy = {p.ind + 1, -1};
      }
      continue;
    }
    used.assign(n, false), temp = inf, ti = -1;
    get_ans(s, -1);
    if (ti != -1 && ans > p.wt + temp) {
      ans = p.wt + temp;
      xy = {p.ind + 1, ti + 1};
    }
  }
  if (xy.first == -1) {
    cout << -1 << "\n";
    return;
  }
  cout << ans << "\n";
  if (xy.second != -1)
    cout << 2 << "\n" << xy.first << " " << xy.second << "\n";
  else
    cout << 1 << "\n" << xy.first << "\n";
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long t = 1;
  while (t--) {
    read();
    solve();
  }
}
