#include <bits/stdc++.h>
using namespace std;
const long long oo = 1e15;
int n, m, s, t, p[1001], ed[1001], vis[1001], vsId, dfs_low[1010],
    dfs_num[1010], counter = 1, dfs_parent[1010];
bool is[30001], block[30001];
vector<int> bb;
map<pair<int, int>, int> freq;
struct edge {
  int u, v, w, idx;
};
edge E[300001];
vector<pair<int, int> > g[1001];
void bridge(int u) {
  dfs_low[u] = dfs_num[u] = counter++;
  for (int i = 0; i < g[u].size(); ++i) {
    int idx = g[u][i].second;
    if (block[idx]) continue;
    int v = g[u][i].first;
    if (dfs_num[v] == -1) {
      dfs_parent[v] = u;
      bridge(v);
      if (dfs_low[v] > dfs_num[u]) {
        bb.push_back(idx);
        is[idx] = 1;
      }
      dfs_low[u] = min(dfs_low[u], dfs_low[v]);
    } else if (v != dfs_parent[u]) {
      dfs_low[u] = min(dfs_low[u], dfs_num[v]);
    }
  }
}
vector<int> path(int s, int t) {
  queue<int> q;
  memset(p, -1, sizeof p);
  q.push(s);
  vis[s] = vsId;
  while (q.size()) {
    int src = q.front();
    q.pop();
    for (int i = 0; i < g[src].size(); ++i) {
      int go = g[src][i].first;
      int idx = g[src][i].second;
      if (block[idx]) continue;
      if (vis[go] == vsId) continue;
      vis[go] = vsId;
      p[go] = src;
      ed[go] = idx;
      q.push(go);
    }
  }
  vector<int> path;
  if (vis[t] != vsId) return path;
  int cur = t;
  while (cur != s) {
    path.push_back(ed[cur]);
    cur = p[cur];
  }
  reverse(path.begin(), path.end());
  return path;
}
int need = 2e9 + 1;
vector<int> res;
int main() {
  scanf("%d%d", &n, &m);
  scanf("%d%d", &s, &t);
  for (int i = 1; i <= m; ++i) {
    scanf("%d%d%d", &E[i].u, &E[i].v, &E[i].w);
    if (E[i].u > E[i].v) swap(E[i].u, E[i].v);
    freq[make_pair(E[i].u, E[i].v)]++;
    g[E[i].u].push_back(make_pair(E[i].v, i));
    g[E[i].v].push_back(make_pair(E[i].u, i));
  }
  vsId++;
  vector<int> p = path(s, t);
  if (vis[t] != vsId) {
    printf("0\n0\n");
    return 0;
  } else {
    for (int i = 0; i < p.size(); ++i) {
      int rem = p[i];
      block[rem] = 1;
      freq[make_pair(E[rem].u, E[rem].v)]--;
      vsId++;
      vector<int> nw = path(s, t);
      int have = E[rem].w;
      if (vis[t] != vsId) {
        if (have < need) {
          need = have;
          res.clear();
          res.push_back(rem);
        }
      } else {
        memset(dfs_num, -1, sizeof dfs_num);
        memset(dfs_parent, -1, sizeof dfs_parent);
        counter = 1;
        bridge(s);
        for (int j = 0; j < nw.size(); ++j) {
          if (is[nw[j]] && freq[make_pair(E[nw[j]].u, E[nw[j]].v)] == 1) {
            if (have + E[nw[j]].w < need) {
              need = have + E[nw[j]].w;
              res.clear();
              res.push_back(rem);
              res.push_back(nw[j]);
            }
          }
        }
      }
      while (bb.size()) {
        is[bb.back()] = 0;
        bb.pop_back();
      }
      block[rem] = 0;
      freq[make_pair(E[rem].u, E[rem].v)]++;
    }
  }
  if (res.size()) {
    printf("%d\n", need);
    printf("%d\n", (int)res.size());
    for (int i = 0; i < res.size(); ++i) {
      printf("%d ", res[i]);
    }
    puts("");
  } else {
    printf("-1\n");
  }
  return 0;
}
