#include <bits/stdc++.h>
using namespace std;
int lst[1005], nxt[60004], to[60004], w[60004], tol;
void adde(int u, int v, int w) {
  nxt[tol] = lst[u];
  to[tol] = v;
  ::w[tol] = w;
  lst[u] = tol;
  ++tol;
}
int N, M;
int S, T;
int low[1005], dfn[1005], pdf;
int stk[1005], ins[1005] = {}, top;
int tag[1005];
int f[1005];
int elim;
void tarjan(int u, int from) {
  low[u] = dfn[u] = pdf++;
  stk[top++] = u;
  ins[u] = 1;
  for (int p = lst[u]; p != -1; p = nxt[p]) {
    if ((p >> 1) == elim || (p ^ 1) == from) continue;
    int v = to[p];
    if (!dfn[v]) {
      tarjan(v, p), low[u] = min(low[u], low[v]);
      if (low[v] == dfn[v]) {
        f[v] = p;
      }
    } else if (ins[v])
      low[u] = min(low[u], low[v]);
  }
  if (low[u] == dfn[u]) {
    do {
      --top;
      ins[stk[top]] = 0;
      tag[stk[top]] = u;
    } while (stk[top] != u);
  }
}
int work(int &cs) {
  memset(dfn, 0, sizeof(dfn));
  pdf = 1, top = 0;
  tarjan(S, -1);
  if (dfn[T] == 0) return 0;
  int res = 1e9 + 10;
  int u = tag[T];
  while (u != S) {
    if (res > w[f[u]]) {
      res = w[f[u]];
      cs = f[u];
    }
    u = tag[to[f[u] ^ 1]];
  }
  return res;
}
int vis[1005];
void dfs(int u) {
  vis[u] = 1;
  for (int p = lst[u]; p != -1; p = nxt[p]) {
    int v = to[p];
    if (!vis[v]) {
      f[v] = p;
      dfs(v);
    }
  }
}
void solve() {
  memset(lst, 0xff, sizeof(lst));
  tol = 0;
  cin >> N >> M;
  cin >> S >> T;
  for (int i = 0; i < (M); ++i) {
    int u, v, w;
    scanf("%d%d%d", &u, &v, &w);
    adde(u, v, w);
    adde(v, u, w);
  }
  memset(vis, 0, sizeof(vis));
  dfs(S);
  if (!vis[T]) {
    cout << 0 << endl;
    cout << 0 << endl;
    return;
  }
  vector<int> path;
  {
    int u = T;
    while (u != S) {
      path.push_back(f[u]);
      u = to[f[u] ^ 1];
    }
  }
  int res = 2e9 + 10;
  pair<int, int> cs;
  for (int i : path) {
    elim = i >> 1;
    int c = -1;
    int ans = work(c);
    if (ans < 1e9 + 10 && res > ans + w[i]) {
      res = ans + w[i];
      cs = make_pair((i), (c));
    }
  }
  if (res == 2e9 + 10) {
    cout << -1 << endl;
  } else {
    cout << res << endl;
    if (cs.second >= 0) {
      cout << 2 << endl;
      cout << (cs.first >> 1) + 1 << " " << (cs.second >> 1) + 1 << endl;
    } else {
      cout << 1 << endl;
      cout << (cs.first >> 1) + 1 << endl;
    }
  }
}
int main() {
  solve();
  return 0;
}
