#include <bits/stdc++.h>
using namespace std;
const int N = 1e3 + 3, M = 3e4 + 4, inf = 2e9 + 1;
int m, n, s, t, cur, tim, mn;
int low[N], dfn[N], vis[N], cst[M];
vector<pair<int, int> > vt[N];
vector<int> pat, rut, ans;
bool dfs(int u) {
  vis[u] = 1;
  if (u == t) return 1;
  for (int i = 0; i < vt[u].size(); i++) {
    int v = vt[u][i].first;
    int id = vt[u][i].second;
    if (!vis[v] && dfs(v)) {
      pat.push_back(id);
      return 1;
    }
  }
  return 0;
}
bool tarjan(int u, int p = -1) {
  vis[u] = 1;
  bool cap = u == t;
  low[u] = dfn[u] = ++tim;
  for (int i = 0; i < vt[u].size(); i++) {
    int v = vt[u][i].first;
    int id = vt[u][i].second;
    if (id == cur || id == p) continue;
    if (vis[v])
      low[u] = min(low[u], dfn[v]);
    else {
      bool flag = tarjan(v, id);
      cap = flag || cap;
      low[u] = min(low[u], low[v]);
      if (flag && low[v] == dfn[v]) rut.push_back(id);
    }
  }
  return cap;
}
int main() {
  scanf("%d%d%d%d", &n, &m, &s, &t);
  for (int i = 1; i < m + 1; i++) {
    int u, v, w;
    scanf("%d%d%d", &u, &v, &w);
    vt[u].push_back(make_pair(v, i));
    vt[v].push_back(make_pair(u, i));
    cst[i] = w;
  }
  if (!dfs(s)) {
    puts("0\n0\n");
    return 0;
  }
  mn = inf;
  for (int i = 0; i < pat.size(); i++) {
    cur = pat[i];
    tim = 0;
    memset(vis, 0, sizeof(vis));
    rut.clear();
    if (!tarjan(s))
      if (mn > cst[cur]) {
        mn = cst[cur];
        ans.clear();
        ans.push_back(cur);
      }
    for (int j = 0; j < rut.size(); j++) {
      int sec = rut[j];
      if (mn > cst[sec] + cst[cur]) {
        mn = cst[sec] + cst[cur];
        ans.clear();
        ans.push_back(cur);
        ans.push_back(sec);
      }
    }
  }
  if (mn == inf) {
    puts("-1");
    return 0;
  }
  int len = ans.size();
  printf("%d\n%d\n%d", mn, len, ans[0]);
  if (len > 1)
    printf(" %d\n", ans[1]);
  else
    puts("");
}
