#include <bits/stdc++.h>
const double eps = (1e-9);
using namespace std;
int dcmp(long double a, long double b) {
  return fabsl(a - b) <= eps ? 0 : (a > b) ? 1 : -1;
}
int getBit(long long num, int idx) { return ((num >> idx) & 1ll) == 1; }
int setBit1(int num, int idx) { return num | (1 << idx); }
long long setBit0(long long num, int idx) { return num & ~(1ll << idx); }
long long flipBit(long long num, int idx) { return num ^ (1ll << idx); }
void FS() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
int countNumBit1(int mask) {
  int ret = 0;
  while (mask) {
    mask &= (mask - 1);
    ++ret;
  }
  return ret;
}
const int N = 1001;
const int M = 30001;
int n, m, S, T;
int best = INT_MAX;
int id1 = -1, id2 = -1, forbid, vis[M], timer, dfsN[N], lwlink[N], par[N],
    rnk[N];
vector<vector<pair<int, int> > > v(N), tree(N);
int cost[M];
vector<int> path, Br;
vector<pair<int, pair<int, int> > > B;
bool dfs(int no) {
  if (no == T) return true;
  vis[no] = 1;
  for (int i = 0; i < ((int)(v[no]).size()); i++) {
    int nw = v[no][i].first;
    int id = v[no][i].second;
    if (vis[nw]) continue;
    path.push_back(id);
    bool ret = dfs(nw);
    if (ret == true) return true;
    path.pop_back();
  }
  return false;
}
bool reach;
int visID = 1;
int getpar(int n) {
  if (par[n] == n) return n;
  return par[n] = getpar(par[n]);
}
void lnk(int a, int b) {
  a = getpar(a);
  b = getpar(b);
  if (a != b) {
    if (rnk[a] > rnk[b])
      rnk[a] += rnk[b], rnk[b] = 0, par[b] = a;
    else
      rnk[b] += rnk[a], rnk[a] = 0, par[a] = b;
  }
}
void dfs1(int no) {
  if (no == T) reach = 1;
  dfsN[no] = timer;
  lwlink[no] = timer++;
  for (int i = 0; i < ((int)(v[no]).size()); i++) {
    int nw = v[no][i].first;
    int id = v[no][i].second;
    if (id == forbid || vis[id] == visID) continue;
    vis[id] = visID;
    if (dfsN[nw] == 0) {
      dfs1(nw);
      lwlink[no] = min(lwlink[no], lwlink[nw]);
      if (lwlink[nw] > dfsN[no])
        B.push_back(make_pair(id, make_pair(no, nw)));
      else
        lnk(no, nw);
    } else {
      lwlink[no] = min(lwlink[no], lwlink[nw]);
    }
  }
}
void I() {
  for (int i = 0; i < N; i++) par[i] = i, rnk[i] = 1;
}
bool dfs2(int no, int Tar) {
  if (no == Tar) return 1;
  vis[no] = visID;
  for (int i = 0; i < ((int)(tree[no]).size()); i++) {
    int nw = tree[no][i].first;
    int id = tree[no][i].second;
    if (vis[nw] == visID) continue;
    Br.push_back(id);
    bool ret = dfs2(nw, Tar);
    if (ret == 1) return 1;
    Br.pop_back();
  }
  return 0;
}
void solve() {
  timer = 1;
  visID++;
  memset(dfsN, 0, sizeof(dfsN));
  memset(lwlink, 0, sizeof(lwlink));
  B.clear();
  Br.clear();
  tree.clear();
  tree.resize(N);
  I();
  reach = 0;
  dfs1(S);
  if (reach == 0) {
    if (cost[forbid] < best) {
      best = cost[forbid];
      id1 = forbid;
      id2 = -1;
    }
    return;
  }
  for (int i = 0; i < ((int)(B).size()); i++) {
    int f = getpar(B[i].second.first), t = getpar(B[i].second.second);
    tree[f].push_back(make_pair(t, B[i].first));
    tree[t].push_back(make_pair(f, B[i].first));
  }
  visID++;
  dfs2(getpar(S), getpar(T));
  for (int i = 0; i < ((int)(Br).size()); i++) {
    if (cost[Br[i]] + cost[forbid] < best) {
      best = cost[Br[i]] + cost[forbid];
      id1 = forbid;
      id2 = Br[i];
    }
  }
}
int main() {
  FS();
  cin >> n >> m >> S >> T;
  int f, t, w;
  for (int i = 0; i < m; i++) {
    cin >> f >> t >> w;
    v[f].push_back(make_pair(t, i));
    v[t].push_back(make_pair(f, i));
    cost[i] = w;
  }
  if (dfs(S) == 0) {
    cout << "0\n0\n";
    return 0;
  }
  for (int i = 0; i < ((int)(path).size()); i++) {
    forbid = path[i];
    solve();
  }
  if (best == INT_MAX)
    cout << "-1\n";
  else {
    if (id2 == -1)
      cout << best << "\n1\n" << id1 + 1 << endl;
    else
      cout << best << "\n2\n" << id1 + 1 << " " << id2 + 1 << endl;
  }
}
