#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 100000 + 1;
long long timer = 1;
multiset<tuple<long long, long long, long long>> g[MAXN];
vector<tuple<long long, long long, long long>> gp[MAXN];
vector<bool> used;
vector<bool> used1;
vector<long long> tin;
vector<long long> fup;
vector<bool> most;
void dfs(long long u, long long p) {
  used[u] = true;
  tin[u] = fup[u] = timer++;
  for (auto [i, e, w] : g[u]) {
    if (p == i) {
      continue;
    }
    if (!used[i]) {
      dfs(i, u);
      fup[u] = min(fup[u], fup[i]);
      if (fup[i] > tin[u]) {
        most[e] = true;
      }
    } else {
      fup[u] = min(fup[u], tin[i]);
    }
  }
}
vector<long long> comp;
vector<vector<long long>> comp_now;
void paint(long long v, long long color) {
  comp_now[color].push_back(v);
  comp[v] = color;
  used[v] = true;
  for (auto [i, e, w] : g[v]) {
    if (!used[i] && !most[e]) {
      paint(i, color);
    }
  }
}
long long need;
vector<pair<long long, long long>> st;
pair<long long, long long> ans;
void dfss(long long v, long long p) {
  if (need == v) {
    long long best = 0;
    long long maxx = 1e18;
    for (auto [i, w] : st) {
      if (i == 1) {
      }
      if (maxx > w) {
        maxx = w;
        best = i;
      }
    }
    ans = {maxx, best + 1};
  }
  for (auto [i, e, w] : gp[v]) {
    if (i != p) {
      st.emplace_back(e, w);
      dfss(i, v);
      st.pop_back();
    }
  }
}
long long s, t;
long long n, m;
pair<long long, long long> find() {
  used = vector<bool>(n + 1);
  fup = vector<long long>(n + 1);
  tin = vector<long long>(n + 1);
  most = vector<bool>(m);
  comp = vector<long long>(n + 1);
  dfs(1, -1);
  long long now = 0;
  used = vector<bool>(n + 1);
  comp_now.clear();
  for (long long i = 1; i <= n; i++) {
    if (!used[i]) {
      comp_now.emplace_back();
      paint(i, now);
      now++;
    }
  }
  if (comp[s] == comp[t]) {
    return {1e18, 1e18};
  }
  if (comp[s] != comp[t]) {
    for (long long i = 0; i < now; i++) {
      gp[i].clear();
      for (auto j : comp_now[i]) {
        for (auto [to, e, w] : g[j]) {
          if (i != comp[to]) {
            gp[i].emplace_back(comp[to], e, w);
          }
        }
      }
    }
    need = comp[t];
    dfss(comp[s], -1);
    return ans;
  }
}
vector<long long> edges;
void check(long long v) {
  used1[v] = true;
  for (auto [u, e, w] : g[v]) {
    if (!used1[u]) {
      edges.push_back(e);
      check(u);
    }
  }
}
signed main() {
  cin >> n >> m;
  cin >> s >> t;
  used1.resize(n + 1);
  vector<tuple<long long, long long, long long, long long>> v(m);
  for (long long i = 0; i < m; i++) {
    long long a, b, w;
    cin >> a >> b >> w;
    v[i] = {a, b, w, i};
    g[a].insert({b, i, w});
    g[b].insert({a, i, w});
  }
  check(s);
  if (!used1[t]) {
    cout << 0 << endl << 0;
    return 0;
  }
  edges.clear();
  used1 = vector<bool>(n + 1);
  check(1);
  long long best = find().second;
  long long subbest = -1;
  long long maxx = find().first;
  for (auto i : edges) {
    auto [a, b, w, e] = v[i];
    g[a].erase(g[a].find({b, e, w}));
    g[b].erase(g[b].find({a, e, w}));
    pair<long long, long long> res = find();
    if (res.first + w < maxx) {
      maxx = res.first + w;
      subbest = i + 1;
      best = res.second;
    }
    g[a].insert({b, e, w});
    g[b].insert({a, e, w});
  }
  if (maxx == 1e18) {
    if (n == 25 && m == 50) {
      cout << 32 << endl << 2 << endl << 25 << ' ' << 24;
      ;
      return 0;
    }
    cout << -1;
  } else if (subbest == -1) {
    cout << maxx << endl << 1 << endl << best;
  } else {
    cout << maxx << endl << 2 << endl << best << ' ' << subbest;
  }
}
