#include <bits/stdc++.h>
using namespace std;
const int N = 1005, M = 30005;
int n, m, s, t, visit[N], low[N], pre[N], num[N], par[N], Time, ban, edge[M],
    oo = 2 * 1e9 + 1;
vector<pair<int, int> > a[N];
vector<int> path;
pair<int, int> luu;
bool dfs1(int u) {
  visit[u] = 1;
  if (u == t) return 1;
  for (int i = 0; i < a[u].size(); i++) {
    int v = a[u][i].first, id = a[u][i].second;
    if (visit[v] == 0) {
      path.push_back(id);
      if (dfs1(v)) return 1;
    }
  }
  if (path.size() > 0) path.pop_back();
  return false;
}
void dfs(int u) {
  visit[u] = 1;
  low[u] = num[u] = ++Time;
  for (int i = 0; i < a[u].size(); i++) {
    int v = a[u][i].first, id = a[u][i].second;
    if (id == pre[u] || id == ban) continue;
    if (visit[v])
      low[u] = min(low[u], num[v]);
    else {
      par[v] = u;
      pre[v] = id;
      dfs(v);
      low[u] = min(low[u], low[v]);
    }
  }
}
int main() {
  ios_base ::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m >> s >> t;
  for (int i = 1; i <= m; i++) {
    int u, v, c;
    cin >> u >> v >> c;
    a[u].push_back(make_pair(v, i));
    a[v].push_back(make_pair(u, i));
    edge[i] = c;
  }
  if (dfs1(s) == 0) {
    cout << 0 << ' ' << 0;
    return 0;
  }
  int res = oo;
  for (int j = 0; j < path.size(); j++) {
    int i = path[j];
    ban = i;
    memset(visit, 0, sizeof visit);
    Time = 0;
    dfs(s);
    if (visit[t] == 0) {
      if (res > edge[i]) {
        res = edge[i];
        luu = make_pair(i, 0);
      }
      continue;
    }
    int v = t;
    while (v != s) {
      int id = pre[v];
      if (low[v] == num[v] && res > edge[i] + edge[id]) {
        res = edge[i] + edge[id];
        luu = make_pair(i, id);
      }
      v = par[v];
    }
  }
  if (res == oo)
    cout << -1;
  else {
    cout << res << '\n';
    if (luu.second)
      cout << 2 << '\n' << luu.first << ' ' << luu.second;
    else
      cout << 1 << '\n' << luu.first;
  }
}
