#include <bits/stdc++.h>
using namespace std;
const int N = 1e3 + 10, M = 3e4 + 10;
struct ed {
  int v, u, w, id;
  ed() {
    v = u = id = -1;
    w = 1e9 + 10;
  }
  ed(int v, int u, int w, int id) : v(v), u(u), w(w), id(id) {}
} e[M];
bool vis[N], dp[N];
vector<pair<int, ed> > g[N];
vector<ed> tree;
int ans, n, m, s, t, mn[N], h[N];
ed a, b, other, inval;
void dfs(int v, ed to) {
  vis[v] = true;
  if (to.id != -1) tree.push_back(to);
  for (auto U : g[v])
    if (!vis[U.first]) dfs(U.first, U.second);
}
void dfsCalc(int v, int par, ed to) {
  h[v] = par >= 0 ? h[par] + 1 : 0;
  mn[v] = h[v];
  vis[v] = true;
  for (auto U : g[v]) {
    int u = U.first;
    if (U.second.id == to.id || U.second.id == inval.id) continue;
    if (vis[u])
      mn[v] = min(mn[v], h[u]);
    else {
      dfsCalc(u, v, U.second);
      mn[v] = min(mn[v], mn[u]);
      dp[v] |= dp[u];
    }
  }
  dp[v] |= (v == s);
  if (dp[v] && mn[v] >= h[v] && other.w > to.w) other = to;
}
void eval(ed E) {
  inval = E;
  for (int i = 0; i < n; i++) {
    mn[i] = 1e9;
    vis[i] = dp[i] = false;
  }
  if (ans < E.w) return;
  other = ed();
  dfsCalc(t, -1, ed());
  if (!vis[s]) {
    ans = E.w;
    a = E;
    b = ed();
    return;
  }
  if (other.id > -1 && ans > other.w + E.w) {
    ans = other.w + E.w;
    a = E;
    b = other;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> m >> s >> t;
  s--;
  t--;
  for (int i = 0; i < m; i++) {
    int a, b, w;
    cin >> a >> b >> w;
    a--;
    b--;
    e[i] = ed(a, b, w, i + 1);
    g[a].push_back({b, e[i]});
    g[b].push_back({a, e[i]});
  }
  ans = 2e9 + 10;
  dfs(s, ed());
  if (!vis[t]) {
    cout << "0\n0\n";
    return 0;
  }
  for (auto i : tree) eval(i);
  if (ans > 2e9) {
    cout << "-1\n";
    return 0;
  }
  cout << ans << "\n" << (1 + (b.id != -1)) << "\n" << a.id;
  if (b.id == -1)
    cout << "\n";
  else
    cout << " " << b.id << "\n";
}
