#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <queue>
using namespace std;

struct edge{
	long long v, t, k;
};

const long long N = 1e5 + 10;
const long long INF = 1e18;
vector<edge> node[N];
long long n, m, x, y,  st[N];
long long d[N];

long long dijkstra() {
	for (long long i = 1; i <= n; i++) d[i] = INF;
	d[x] = 0;
	priority_queue<pair<long long, long long>> q;
	q.push({0, x});

	while (!q.empty()) {
		long long u = q.top().second; q.pop();
		if (st[u]) continue;
		st[u] = 1;

		for (auto e : node[u]) {
			long long v = e.v, t = e.t, k = e.k;

			if (d[u] % k == 0) {
				if (d[u] + t < d[v]) {
					d[v] = d[u] + t;
					q.push({-d[v], v});
				}
			} else {
				if (d[u] + k - (d[u] % k) + t < d[v]) {
					d[v] = d[u] + (k - d[u] % k) + t;
					
					q.push({-d[v], v});
				}
			}
		}
	}

	if (d[y] == 1e18) return -1;
	return d[y];
}

int main() {
	
	cin >> n >> m >> x >> y;
	while (m--) {
		long long u, v, t, k;
		cin >> u >> v >> t >> k;
		node[u].push_back({v, t, k});
		node[v].push_back({u, t, k});
	}
	cout << dijkstra() << '\n';

	return 0;
}
/**
 * author  : UshanGhosh
 * created : 2021-06-27 12:02:50
**/  

#include<bits/stdc++.h>
using namespace std;

#define    ll      long long
#define    pii     pair<int,int>
#define    vii     vector<int>
#define    vcc     vector<char>
#define    pll     pair<long long, long long>
#define    mem     memset
#define    sof     sizeof
#define    co1     __builtin_popcountll
#define    PB      push_back
#define    UB      upper_bound
#define    LB      lower_bound
#define    MP      make_pair
#define    TS      to_string
#define    F       first
#define    S       second
#define    pi      acos(-1)
#define    mod     (long long)1000000007
#define    inf     (long long)1e18
#define    endl    '\n'

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int t=1;
    while(t--){
        long long a,b,c,d,e,f,i,j,k,m,n,o,x,y;
        cin >> a >> b >> c >> d;
        ll p1 = a, p2 = 0;
        for(i=1; i<=100005; i++) {
            p1 += b;
            p2 += c;
            ll div = (p1 - 1) / p2 + 1;
            if(div <= d) {
                cout << i << "\n";
                return 0;
            }
        } 
        cout << -1 << "\n";
    }
}