#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1000;
const int MAXM = 30000;
const int oops = 2e9 + 7;
struct Edge {
  int u, v, cost, id;
};
vector<Edge> edges;
vector<Edge> G[MAXN + 5];
vector<int> anypath, bridges;
bool vis[MAXN + 5];
int dfstime[MAXN + 5], lowlink[MAXN + 5];
int n, m;
int source, sink;
int removed;
int ret = oops;
pair<int, int> best;
int tim;
void minimize(int id) {
  int cost = edges[id].cost;
  if (~removed) cost += edges[removed].cost;
  if (ret > cost) {
    ret = cost;
    best = make_pair(id, removed);
  }
}
void dfs(int u, int pid = -1) {
  dfstime[u] = lowlink[u] = tim++;
  for (const Edge& e : G[u]) {
    if (e.id == pid || e.id == removed) continue;
    if (!~dfstime[e.v]) {
      bool reached = ~dfstime[sink];
      dfs(e.v, e.id);
      if (lowlink[e.v] > dfstime[u] && !reached && ~dfstime[sink])
        minimize(e.id);
    }
    lowlink[u] = min(lowlink[u], lowlink[e.v]);
  }
}
bool getAnyPath(int u, int pid = -1) {
  if (u == sink) return true;
  if (vis[u]) return false;
  vis[u] = true;
  for (const Edge& e : G[u]) {
    if (e.id == pid) continue;
    if (getAnyPath(e.v, e.id)) {
      anypath.push_back(e.id);
      return true;
    }
  }
  return false;
}
void addEdge(int u, int v, int cost, int ix) {
  G[u].push_back({u, v, cost, ix});
  G[v].push_back({v, u, cost, ix});
  edges.push_back({u, v, cost, ix});
}
int main() {
  int c, c2;
  scanf("%d%d%d%d", &n, &m, &source, &sink);
  source--;
  sink--;
  for (c = 0; c < m; c++) {
    int u, v, cost;
    scanf("%d%d%d", &u, &v, &cost);
    addEdge(u - 1, v - 1, cost, c);
  }
  if (!getAnyPath(source))
    printf("0\n0\n");
  else {
    anypath.push_back(-1);
    for (int id : anypath) {
      removed = id;
      tim = 0;
      memset(dfstime, -1, sizeof(dfstime));
      dfs(source);
    }
    if (ret == oops)
      printf("-1\n");
    else {
      printf("%d\n", ret);
      if (~best.second)
        printf("2\n%d %d\n", best.first + 1, best.second + 1);
      else
        printf("1\n%d\n", best.first + 1);
    }
  }
  return 0;
}
