#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
using ll = long long;
using P = pair<int,int>;

int main() {
	int a,b,c,d;
	cin >> a >> b >> c >> d;
	int n=0;
	if (a <= n*d*c) {
		cout << n << endl;
		return 0;
	}
	n++;
	if (d*c-b <= 0) {
		cout << -1 << endl;
		return 0;
	}
	while ( a > n*(d*c-b)) {
		n++;
	}
	cout << n++ << endl;
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define endl '\n'
typedef pair<int, int> P;
typedef long long ll;
class Combination
{
    vector<long long> fact;
    vector<long long> factinv;
    long long MOD = 1e9 + 7;
    long long modpow(long long a, long long n)
    {
        if (n == 0)
            return 1;
        if (n % 2 == 0)
        {
            long long t = modpow(a, n / 2);
            return t * t % MOD;
        }
        return a * modpow(a, n - 1) % MOD;
    }

    long long modinv(long long a)
    {
        // mod is prime
        return modpow(a, MOD - 2);
    }

public:
    Combination(int n) : fact(n), factinv(n)
    {
        fact[0] = 1;
        for (int i = 1; i < n; i++)
        {
            fact[i] = fact[i - 1] * i % MOD;
        }
        factinv[n - 1] = modinv(fact[n - 1]);
        for (int i = n - 2; i >= 0; i--)
        {
            factinv[i] = factinv[i + 1] * (i + 1) % MOD;
        }
    }

    long long ncr(long long n, long long r)
    {
        if (r < 0 || r > n)
            return 0;
        return fact[n] * factinv[r] % MOD * factinv[n - r] % MOD;
    }

    long long npr(long long n, long long r)
    {
        if (r < 0 || r > n)
            return 0;
        return fact[n] * factinv[n - r] % MOD;
    }

    long long nhr(long long n, long long r)
    {
        if (n == 0 && r == 0)
            return 1;
        return ncr(n + r - 1, r);
    }
};

ll solve1(int n)
{
    ll ans = 0;
    ll mod = 1e9 + 7;
    Combination C(100000);
    for (int i = 1; i <= n / 2; i++)
    {
        ans += C.nhr(i, n - 2 * i);
        ans %= mod;
    }
    return ans;
}

ll solve2(int n)
{
    if (n <= 2)
    {
        return 1;
    }
    ll ans = 1;
    ll mod = 1e9 + 7;
    for (int i = 0; i < n - 3; i++)
    {
        ans *= 2;
        ans %= mod;
    }
    return ans;
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    ll ans = 0;
    char caa, cab, cba, cbb;
    cin >> caa >> cab >> cba >> cbb;
    if (cab == 'A')
    {
        if (caa == 'A')
        {
            ans = 1;
        }
        else
        {
            if (cba == 'A')
            {
                ans = solve1(n);
            }
            else
            {
                ans = solve2(n);
            }
        }
    }
    else
    {
        if (cbb == 'B')
        {
            ans = 1;
        }
        else
        {
            if (cba == 'B')
            {
                ans = solve1(n);
            }
            else
            {
                ans = solve2(n);
            }
        }
    }
    cout << ans << endl;
}