#include <bits/stdc++.h>
using namespace std;
const int INF = 2020202020;
vector<vector<int>> G;
void bridge_dfs(int now, int from, vector<pair<int, int>> &bridge,
                vector<vector<int>> &bicomp, stack<int> &roots, stack<int> &S,
                vector<bool> &inS, vector<int> &preord, int &pre_ct) {
  preord[now] = pre_ct++;
  S.push(now);
  inS[now] = true;
  roots.push(now);
  for (int(i) = 0; (i) < (int)(G[now].size()); ++(i)) {
    int to = G[now][i];
    if (preord[to] == -1)
      bridge_dfs(to, now, bridge, bicomp, roots, S, inS, preord, pre_ct);
    else if (from != to && inS[to])
      while (preord[roots.top()] > preord[to]) roots.pop();
  }
  if (now == roots.top()) {
    bridge.push_back(pair<int, int>(now, from));
    bicomp.push_back(vector<int>());
    while (1) {
      int v = S.top();
      S.pop();
      inS[v] = false;
      bicomp.back().push_back(v);
      if (now == v) break;
    }
    roots.pop();
  }
}
void bridge_detect(vector<pair<int, int>> &bridge,
                   vector<vector<int>> &bicomp) {
  const int n = G.size();
  vector<int> preord(n, -1);
  vector<bool> inS(n, false);
  stack<int> roots, S;
  int pre_ct = 0;
  for (int(i) = 0; (i) < (int)(n); ++(i))
    if (preord[i] == -1) {
      bridge_dfs(i, n, bridge, bicomp, roots, S, inS, preord, pre_ct);
      bridge.pop_back();
    }
}
void solve() {
  int n, m, s, t;
  scanf(" %d %d", &n, &m);
  scanf(" %d %d", &s, &t);
  --s;
  --t;
  G = vector<vector<int>>(n);
  map<pair<int, int>, vector<pair<int, int>>> e_count;
  vector<int> x(m), y(m), w(m);
  for (int(i) = 0; (i) < (int)(m); ++(i)) {
    scanf(" %d %d %d", &x[i], &y[i], &w[i]);
    --x[i];
    --y[i];
    e_count[pair<int, int>(x[i], y[i])].push_back(pair<int, int>(i, w[i]));
    e_count[pair<int, int>(y[i], x[i])].push_back(pair<int, int>(i, w[i]));
    G[x[i]].push_back(y[i]);
    G[y[i]].push_back(x[i]);
  }
  queue<int> que;
  vector<bool> vis(n, false);
  vector<int> par(n, -1);
  vis[s] = true;
  que.push(s);
  while (!que.empty()) {
    int v = que.front();
    que.pop();
    for (int(i) = 0; (i) < (int)(G[v].size()); ++(i)) {
      int nx = G[v][i];
      if (!vis[nx]) {
        vis[nx] = true;
        par[nx] = v;
        que.push(nx);
      }
    }
  }
  if (!vis[t]) {
    printf("0\n0\n");
    return;
  }
  int ans = INF;
  int c = -1;
  vector<int> ans_edge;
  vector<pair<int, int>> bridge;
  vector<vector<int>> bicomp;
  bridge_detect(bridge, bicomp);
  set<pair<int, int>> B;
  for (int(i) = 0; (i) < (int)(bridge.size()); ++(i)) B.insert(bridge[i]);
  vector<pair<int, int>> one_path;
  int now = t;
  while (now != s) {
    int P = par[now];
    pair<int, int> E = pair<int, int>(now, P);
    one_path.push_back(E);
    if (B.count(E) || B.count(pair<int, int>(P, now))) {
      if (e_count[E].size() <= 2) {
        int W = 0;
        for (int(i) = 0; (i) < (int)(e_count[E].size()); ++(i))
          W += e_count[E][i].second;
        if (W < ans) {
          ans = W;
          c = e_count[E].size();
          ans_edge.clear();
          for (int(i) = 0; (i) < (int)(e_count[E].size()); ++(i))
            ans_edge.push_back(e_count[E][i].first + 1);
        }
      }
    }
    now = P;
  }
  for (int(i) = 0; (i) < (int)(one_path.size()); ++(i)) {
    pair<int, int> PATH = one_path[i];
    if (e_count[PATH].size() > 1) continue;
    G = vector<vector<int>>(n);
    for (int(j) = 0; (j) < (int)(m); ++(j)) {
      if (PATH == pair<int, int>(x[j], y[j]) ||
          PATH == pair<int, int>(y[j], x[j]))
        continue;
      G[x[j]].push_back(y[j]);
      G[y[j]].push_back(x[j]);
    }
    vis = vector<bool>(n, false);
    par = vector<int>(n, -1);
    que.push(s);
    vis[s] = true;
    while (!que.empty()) {
      int v = que.front();
      que.pop();
      for (int(j) = 0; (j) < (int)(G[v].size()); ++(j)) {
        int nx = G[v][j];
        if (!vis[nx]) {
          vis[nx] = true;
          par[nx] = v;
          que.push(nx);
        }
      }
    }
    if (!vis[t]) continue;
    bridge.clear();
    bicomp.clear();
    bridge_detect(bridge, bicomp);
    B.clear();
    for (int(j) = 0; (j) < (int)(bridge.size()); ++(j)) B.insert(bridge[j]);
    now = t;
    while (now != s) {
      int P = par[now];
      pair<int, int> E = pair<int, int>(now, P);
      if (B.count(E) || B.count(pair<int, int>(P, now))) {
        if (e_count[E].size() == 1) {
          int W = e_count[PATH][0].second + e_count[E][0].second;
          if (W < ans) {
            ans = W;
            c = 2;
            ans_edge.clear();
            ans_edge.push_back(e_count[PATH][0].first + 1);
            ans_edge.push_back(e_count[E][0].first + 1);
          }
        }
      }
      now = P;
    }
  }
  if (ans == INF)
    printf("-1\n");
  else {
    printf("%d\n%d\n", ans, c);
    for (int(i) = 0; (i) < (int)(ans_edge.size()); ++(i)) {
      if (i) printf(" ");
      printf("%d", ans_edge[i]);
    }
    printf("\n");
  }
}
int main() {
  solve();
  return 0;
}
