#include <bits/stdc++.h>
using namespace std;
struct edge {
  int x, y, z;
  edge(int x, int y, int z) : x(x), y(y), z(z) {}
  edge() {}
} e[30010 << 1];
int n, m, s, t, x, y, z, now, pos, cnt;
int low[1010], dfn[1010], is_bridge[30010 << 1], vis[1010], p[1010];
vector<int> linker[1010], v, vec;
inline void addedge(int x, int y, int z) {
  linker[x].push_back(pos);
  e[pos++] = edge(x, y, z);
}
bool augument(int x) {
  vis[x] = 1;
  if (x == t) return 1;
  for (int i = 0; i < linker[x].size(); i++)
    if (linker[x][i] != now && linker[x][i] != (now ^ 1) &&
        !vis[e[linker[x][i]].y] && augument(e[linker[x][i]].y)) {
      v.push_back(linker[x][i]);
      return 1;
    }
  return 0;
}
void tarjan(int x) {
  low[x] = dfn[x] = ++cnt;
  for (int i = 0; i < linker[x].size(); i++)
    if (linker[x][i] != now && linker[x][i] != (now ^ 1))
      if (!dfn[e[linker[x][i]].y]) {
        p[e[linker[x][i]].y] = linker[x][i];
        tarjan(e[linker[x][i]].y);
        low[x] = min(low[x], low[e[linker[x][i]].y]);
      } else if (p[x] != linker[x][i] && p[x] != (linker[x][i] ^ 1))
        low[x] = min(low[x], dfn[e[linker[x][i]].y]);
  if (~p[x] && low[x] == dfn[x]) is_bridge[p[x]] = 1;
}
struct data {
  int ans, x, y;
  data(int a, int x, int y) : ans(a), x(x), y(y) {}
  data() {}
};
inline bool operator<(data& a, data& b) { return a.ans < b.ans; }
inline void update(data& a, data b) {
  if (b < a) a = b;
}
int main() {
  data ans = data(2000000001, -1, -1);
  cin >> n >> m >> s >> t;
  for (register int i = 1; i <= m; i++) {
    scanf("%d %d %d", &x, &y, &z);
    addedge(x, y, z), addedge(y, x, z);
  }
  now = -1;
  if (!augument(s)) {
    cout << 0 << endl << 0 << endl;
    return 0;
  }
  swap(v, vec);
  for (int i = 0; i < vec.size(); i++) {
    cnt = 0;
    memset(dfn, 0, sizeof(dfn));
    memset(low, 0, sizeof(low));
    memset(is_bridge, 0, sizeof(is_bridge));
    memset(vis, 0, sizeof(vis));
    memset(p, -1, sizeof(p));
    v.clear();
    now = vec[i];
    if (augument(s)) {
      for (int j = 1; j <= n; j++)
        if (!dfn[j]) tarjan(j);
      for (register int j = 0; j < v.size(); j++) {
        if (is_bridge[v[j]]) update(ans, data(e[now].z + e[v[j]].z, now, v[j]));
        if (is_bridge[v[j] ^ 1])
          update(ans, data(e[now].z + e[v[j] ^ 1].z, now, v[j] ^ 1));
      }
    } else
      update(ans, data(e[now].z, now, -1));
  }
  if (ans.ans == 2000000001)
    cout << -1 << endl;
  else {
    cout << ans.ans << endl;
    if (ans.y != -1)
      cout << 2 << endl << ans.x / 2 + 1 << " " << ans.y / 2 + 1 << endl;
    else
      cout << 1 << endl << ans.x / 2 + 1 << endl;
  }
  return 0;
}
