#include <bits/stdc++.h>
using namespace std;
const int MOD = (int)1e9 + 7;
const int INF = (int)1e9;
const long long LINF = (long long)1e18;
const long double PI = acos((long double)-1);
const long double EPS = 1e-9;
inline long long gcd(long long a, long long b) {
  long long r;
  while (b) {
    r = a % b;
    a = b;
    b = r;
  }
  return a;
}
inline long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
inline long long fpow(long long n, long long k, int p = MOD) {
  long long r = 1;
  for (; k; k >>= 1) {
    if (k & 1) r = r * n % p;
    n = n * n % p;
  }
  return r;
}
template <class T>
inline int chkmin(T& a, const T& val) {
  return a > val ? a = val, 1 : 0;
}
template <class T>
inline int chkmax(T& a, const T& val) {
  return a < val ? a = val, 1 : 0;
}
inline long long isqrt(long long k) {
  long long r = sqrt(k) + 1;
  while (r * r > k) r--;
  return r;
}
inline long long icbrt(long long k) {
  long long r = cbrt(k) + 1;
  while (r * r * r > k) r--;
  return r;
}
inline void addmod(int& a, int val, int p = MOD) {
  if ((a = (a + val)) >= p) a -= p;
}
inline void submod(int& a, int val, int p = MOD) {
  if ((a = (a - val)) < 0) a += p;
}
inline int mult(int a, int b, int p = MOD) { return (long long)a * b % p; }
inline int inv(int a, int p = MOD) { return fpow(a, p - 2, p); }
const int maxn = 1010;
const int maxm = 30010;
int n, m, s, t;
vector<pair<int, int> > adj[maxn];
int w[maxm];
int d[maxm];
int del[maxm];
pair<int, int> from[maxn];
int vis[maxm];
int num[maxn];
int low[maxn];
int cnt;
vector<int> getpath() {
  fill_n(vis, m, 0);
  fill_n(from, n, make_pair(-1, -1));
  queue<int> q;
  q.push(s);
  vis[s] = 1;
  while (int((q).size())) {
    int u = q.front();
    q.pop();
    for (int i = (0); i < (int((adj[u]).size())); i++) {
      int v = adj[u][i].first;
      int id = adj[u][i].second;
      if (!vis[v] && !del[id]) {
        vis[v] = 1;
        from[v] = make_pair(u, id);
        q.push(v);
      }
    }
  }
  vector<int> res;
  if (!~from[t].first) {
    return res;
  }
  int cur = t;
  while (cur != s) {
    res.push_back(from[cur].second);
    cur = from[cur].first;
  }
  reverse((res).begin(), (res).end());
  return res;
}
void dfs(int u, int prv = -1) {
  num[u] = low[u] = ++cnt;
  for (int i = (0); i < (int((adj[u]).size())); i++) {
    int v = adj[u][i].first;
    int id = adj[u][i].second;
    if (!del[id]) {
      if (!num[v]) {
        dfs(v, id);
        chkmin(low[u], low[v]);
        if (low[v] > num[u]) {
          d[id] = 1;
        }
      } else if (id != prv) {
        chkmin(low[u], num[v]);
      }
    }
  }
}
pair<long long, int> work() {
  fill_n(d, m, 0);
  fill_n(num, n, 0);
  fill_n(low, n, 0);
  cnt = 0;
  dfs(s);
  vector<int> path = getpath();
  if (!int((path).size())) {
    return make_pair(0, -1);
  }
  pair<long long, int> res = make_pair(LINF, -1);
  for (int i = (0); i < (int((path).size())); i++) {
    int e = path[i];
    if (d[e]) {
      chkmin(res, make_pair((long long)w[e], e));
    }
  }
  return res;
}
void solve() {
  cin >> n >> m >> s >> t;
  s--;
  t--;
  for (int i = (0); i < (m); i++) {
    int u, v;
    cin >> u >> v >> w[i];
    u--;
    v--;
    adj[u].push_back(make_pair(v, i));
    adj[v].push_back(make_pair(u, i));
  }
  vector<int> path = getpath();
  if (!int((path).size())) {
    cout << 0 << "\n";
    cout << 0 << "\n";
    return;
  }
  pair<long long, pair<int, int> > ans = make_pair(LINF, make_pair(-1, -1));
  for (int i = (0); i < (int((path).size())); i++) {
    int e = path[i];
    del[e] = 1;
    pair<long long, int> r = work();
    chkmin(ans, make_pair(w[e] + r.first, make_pair(e, r.second)));
    del[e] = 0;
  }
  if (ans.first == LINF) {
    cout << -1 << "\n";
    return;
  }
  cout << ans.first << "\n";
  if (~ans.second.second) {
    cout << 2 << "\n";
    cout << ans.second.first + 1 << " ";
    cout << ans.second.second + 1 << "\n";
  } else {
    cout << 1 << "\n";
    cout << ans.second.first + 1 << "\n";
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  solve();
  return 0;
}
