#include <bits/stdc++.h>
using namespace std;
const long long INF = 1 << 28;
const long long LINF = 1ll << 61;
int n, m;
vector<pair<int, int> > g[1011];
long long w[30111];
int vx[30111], vy[30111], S, T;
bool vis[1011], onp[30011], ok[1011];
int ban;
bool init(int x) {
  vis[x] = 1;
  bool ret = 0;
  if (x == T) ret = 1;
  for (int i = 0; i < g[x].size(); i++) {
    if (!vis[g[x][i].first]) {
      if (init(g[x][i].first)) {
        ret = 1;
        onp[g[x][i].second] = 1;
      }
    }
  }
  return ret;
}
int dfn[1011], low[1011], dfntot;
pair<long long, int> dfs(int x, int pre = -1) {
  ok[x] = 0;
  if (x == T) ok[x] = 1;
  dfn[x] = low[x] = ++dfntot;
  vis[x] = 1;
  pair<long long, int> ret = make_pair(1ll << 60, -1);
  for (int i = 0; i < g[x].size(); i++) {
    if (g[x][i].second != ban && g[x][i].second != pre) {
      if (vis[g[x][i].first]) {
        low[x] = min(low[x], dfn[g[x][i].first]);
      } else {
        ret = min(ret, dfs(g[x][i].first, g[x][i].second));
        ok[x] |= ok[g[x][i].first];
        low[x] = min(low[x], low[g[x][i].first]);
        if (dfn[g[x][i].first] == low[g[x][i].first] && ok[g[x][i].first]) {
          ret = min(ret, make_pair(w[g[x][i].second], g[x][i].second));
        }
      }
    }
  }
  return ret;
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> m >> S >> T;
  for (int i = 1; i <= m; i++) {
    int x, y, ww;
    cin >> x >> y >> ww;
    g[x].push_back(make_pair(y, i));
    g[y].push_back(make_pair(x, i));
    w[i] = ww;
    vx[i] = x;
    vy[i] = y;
  }
  init(S);
  if (!vis[T]) {
    cout << 0 << endl << 0 << endl;
    return 0;
  }
  long long ans = 1ll << 60;
  int id1, id2;
  for (int i = 1; i <= m; i++) {
    if (!onp[i]) continue;
    ban = i;
    memset(vis, 0, sizeof(vis));
    dfntot = 0;
    pair<long long, int> tmp = dfs(S);
    if (!ok[S] && w[i] < ans) ans = w[i], id1 = i, id2 = -1;
    if (w[i] + tmp.first < ans)
      ans = w[i] + tmp.first, id1 = i, id2 = tmp.second;
  }
  if (ans == (1ll << 60))
    puts("-1");
  else {
    cout << ans << endl;
    if (id2 == -1)
      cout << 1 << endl << id1 << endl;
    else
      cout << 2 << endl << id1 << " " << id2 << endl;
  }
  return 0;
}
