#include <bits/stdc++.h>
using namespace std;
using ii = pair<long long int, long long int>;
const long long int N = 1000 + 5, M = 30000 + 5;
vector<ii> g[N << 1];
vector<long long int> G;
const long long int INF = 0x3f3f3f3f3f3f3f3f;
long long int edges[M], num[N], low[N], weight[M];
bool del[M], vis[N];
long long int n, m, s, t, cnt = 0, res = INF, res1, res2, timer = 0;
bool chk(long long int u) {
  if (u == t) {
    return true;
  }
  vis[u] = 1;
  for (auto& it : g[u]) {
    long long int v = it.first, index = it.second;
    if (!vis[v]) {
      if (chk(v)) {
        edges[++cnt] = index;
        return true;
      }
    }
  }
  return false;
}
bool dfs(long long int u, long long int block) {
  if (u == t) {
    return true;
  }
  vis[u] = true;
  for (auto& it : g[u]) {
    long long int v = it.first, index = it.second;
    if (!vis[v] and (index != block)) {
      if (dfs(v, block)) {
        G.push_back(index);
        return true;
      }
    }
  }
  return false;
}
void dfs2(long long int u, long long int par, long long int block) {
  num[u] = low[u] = ++timer;
  for (auto& it : g[u]) {
    long long int v = it.first, index = it.second;
    if (index == par || index == block) {
      continue;
    }
    if (!num[v]) {
      dfs2(v, index, block);
      low[u] = min(low[u], low[v]);
      if (num[u] < low[v]) {
        del[index] = true;
      }
    } else {
      low[u] = min(low[u], num[v]);
    }
  }
}
int32_t main() {
  cin.tie(0)->sync_with_stdio(0);
  cin >> n >> m >> s >> t;
  G.resize(m);
  for (long long int i = 1, u, v, w; i <= m; i++) {
    cin >> u >> v >> weight[i];
    g[u].push_back({v, i});
    g[v].push_back({u, i});
  }
  memset(vis, false, sizeof(vis));
  if (!chk(s)) {
    cout << "0\n0";
    return 0;
  }
  for (long long int i = 1; i <= cnt; i++) {
    long long int u = edges[i];
    memset(vis, 0, sizeof(vis));
    G.clear();
    if (!dfs(s, u)) {
      if (res > weight[u]) {
        res = weight[u];
        res1 = u, res2 = 0;
      }
    } else {
      timer = 0;
      memset(num, 0, sizeof(num));
      memset(low, 0, sizeof(low));
      memset(del, false, sizeof(del));
      dfs2(s, 0, u);
      for (auto& it : G) {
        if (del[it] and (res > (weight[u] + weight[it]))) {
          res = weight[u] + weight[it];
          res1 = u, res2 = it;
        }
      }
    }
  }
  if (res == INF) {
    cout << -1;
    return 0;
  }
  cout << res << "\n";
  if (!res2) {
    cout << "1\n" << res1;
    return 0;
  }
  cout << "2\n" << res1 << " " << res2;
  return 0;
}
