#include <bits/stdc++.h>
using namespace std;
int dfn[1005], low[1005], head[1005];
bool is_bridge[1005 * 30], visit[1005], cut[1005 * 30];
int cnt, e;
int n, m, s, t, anse;
vector<int> path, ans, npath;
struct edge {
  int to, next, value, id;
};
edge es[1005 * 60];
void add(int u, int v, int w, int id) {
  es[e].to = v;
  es[e].next = head[u];
  es[e].value = w;
  es[e].id = id;
  head[u] = e++;
}
bool DFS(int now, int pre) {
  if (now == t) return true;
  visit[now] = true;
  for (int i = head[now]; ~i; i = es[i].next) {
    int to = es[i].to, id = es[i].id;
    if (id == pre || visit[to] || cut[id]) continue;
    if (DFS(to, id)) {
      path.push_back(id);
      return true;
    }
  }
  return false;
}
void tarjan(int now, int pre) {
  dfn[now] = low[now] = cnt++;
  for (int i = head[now]; i != -1; i = es[i].next) {
    int to = es[i].to, id = es[i].id;
    if (id == pre || cut[id]) continue;
    if (dfn[to] == 0) {
      tarjan(to, id);
      low[now] = min(low[now], low[to]);
      if (dfn[now] < low[to] && dfn[now] < dfn[to]) {
        is_bridge[id] = true;
      }
    } else {
      low[now] = min(low[now], dfn[to]);
    }
  }
}
void find_bridge() {
  memset(dfn, 0, sizeof(dfn));
  memset(low, 0, sizeof(low));
  memset(is_bridge, 0, sizeof(is_bridge));
  cnt = 0;
  for (int i = 1; i <= n; i++) {
    if (!dfn[i]) tarjan(i, 0);
  }
}
bool find_path() {
  path.clear();
  memset(visit, 0, sizeof(visit));
  return DFS(s, 0);
}
int solve() {
  memset(cut, 0, sizeof(cut));
  ans.clear();
  anse = 2e9 + 5;
  if (!find_path()) {
    cout << 0 << endl << 0 << endl;
    return 0;
  }
  find_bridge();
  for (int i = 0; i < path.size(); i++) {
    int judge = path[i];
    if (is_bridge[judge] && es[judge * 2].value <= anse) {
      ans.clear();
      ans.push_back(judge);
      anse = es[judge * 2].value;
    }
  }
  npath.clear();
  for (int i = 0; i < path.size(); i++) {
    npath.push_back(path[i]);
  }
  for (int i = 0; i < npath.size(); i++) {
    int flag = npath[i];
    cut[flag] = true;
    if (!find_path()) {
      cut[flag] = false;
      continue;
    }
    find_bridge();
    for (int j = 0; j < path.size(); j++) {
      int judge = path[j];
      if (is_bridge[judge] &&
          (es[judge * 2].value + es[flag * 2].value) <= anse) {
        ans.clear();
        ans.push_back(judge);
        ans.push_back(flag);
        anse = es[judge * 2].value + es[flag * 2].value;
      }
    }
    cut[flag] = false;
  }
  return 1;
}
int main() {
  int u, v, w;
  while (cin >> n >> m) {
    cin >> s >> t;
    e = 1;
    memset(head, -1, sizeof(head));
    for (int i = 0; i < m; i++) {
      scanf("%d %d %d", &u, &v, &w);
      add(u, v, w, i + 1);
      add(v, u, w, i + 1);
    }
    if (!solve()) continue;
    if (!ans.size()) {
      cout << -1 << endl;
      continue;
    }
    cout << anse << endl << ans.size() << endl;
    for (int i = 0; i < ans.size(); i++) {
      cout << ans[i] << " ";
    }
  }
  return 0;
}
