#include <bits/stdc++.h>
using namespace std;
template <class T>
using vec = vector<T>;
template <typename Iter>
ostream &_IterOutput_(ostream &o, Iter b, Iter e, const string ss = "",
                      const string se = "") {
  o << ss;
  for (auto it = b; it != e; it++) o << (it == b ? "" : ", ") << *it;
  return o << se;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &o, const pair<T1, T2> &pair) {
  return o << "(" << pair.first << ", " << pair.second << ")";
}
template <typename T>
ostream &operator<<(ostream &o, const vector<T> &vec) {
  return _IterOutput_(o, begin(vec), end(vec), "[", "]");
}
template <typename T>
ostream &operator<<(ostream &o, const set<T> &st) {
  return _IterOutput_(o, begin(st), end(st), "{", "}");
}
template <typename T, size_t N>
ostream &operator<<(ostream &o, const array<T, N> &arr) {
  return _IterOutput_(o, begin(arr), end(arr), "|", "|");
}
template <typename T1, typename T2>
ostream &operator<<(ostream &o, const map<T1, T2> &mp) {
  o << "{";
  for (auto it = mp.begin(); it != mp.end(); it++) {
    o << (it == mp.begin() ? "" : ", ") << it->first << ":" << it->second;
  }
  o << "}";
  return o;
}
const int INF = 2029384756;
const int MX = 33333;
int V, E;
int second, T;
struct Edge {
  int u, v, w;
  inline int o(int x) { return x ^ u ^ v; }
};
vector<Edge> edges;
vector<int> el[MX];
int ans;
vector<int> av;
vector<int> tr1, tr2;
bool no[MX];
bool vt[MX];
bool dfs(int u, vector<int> &trace) {
  vt[u] = true;
  if (u == T) {
    return true;
  }
  for (auto id : el[u]) {
    if (no[id]) continue;
    int v = edges[id].o(u);
    if (v == u) continue;
    if (vt[v]) continue;
    if (dfs(v, trace)) {
      trace.push_back(id);
      return true;
    }
  }
  return false;
}
int dfn[MX], low[MX], did;
void dfs2(int u, int lid) {
  dfn[u] = low[u] = ++did;
  for (auto id : el[u]) {
    if (id == lid) continue;
    if (no[id]) continue;
    int v = edges[id].o(u);
    if (v == u) continue;
    if (!dfn[v]) {
      dfs2(v, id);
      low[u] = min(low[u], low[v]);
    } else {
      low[u] = min(low[u], dfn[v]);
    }
  }
}
void calc(int id) {
  tr2.clear();
  fill(vt, vt + V + 5, 0);
  fill(dfn, dfn + V + 5, 0);
  bool fg = dfs(second, tr2);
  if (!fg) {
    if (ans > edges[id].w) {
      ans = edges[id].w;
      av.clear();
      av.push_back(id + 1);
    }
    return;
  }
  did = 0;
  dfs2(second, -1);
  reverse(begin(tr2), end(tr2));
  int u = second;
  for (auto eid : tr2) {
    auto e = edges[eid];
    int v = e.o(u);
    if (low[v] > dfn[u]) {
      int a = edges[id].w + e.w;
      if (a < ans) {
        ans = a;
        av.clear();
        av.push_back(id + 1);
        av.push_back(eid + 1);
      }
    }
    u = v;
  }
}
int32_t main() {
  do {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
  } while (0);
  cin >> V >> E >> second >> T;
  edges.resize(E);
  ans = INF;
  for (int i = 0; i < E; i++) {
    int u, v, w;
    cin >> u >> v >> w;
    edges[i] = {u, v, w};
    el[u].push_back(i);
    el[v].push_back(i);
  }
  bool fg = dfs(second, tr1);
  if (!fg) {
    cout << 0 << endl;
    cout << 0 << endl;
    return 0;
  }
  for (auto id : tr1) {
    no[id] = true;
    calc(id);
    no[id] = false;
  }
  if (ans >= INF) {
    cout << -1 << endl;
    return 0;
  }
  cout << ans << endl;
  cout << ((int)(av).size()) << endl;
  for (auto x : av) {
    cout << x << ' ';
  }
  cout << endl;
  return 0;
}
