#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1LL << 60;
ll MOD = 1000000000 + 7;

int main() {
    string s, t = "";
    bool rev = false;
    cin >> s;
    for (int i = 0; i < s.size(); i++) {
        if (s[i] == 'R') {
            rev = !rev;
            continue;
        }
        if (t == "") {
            t += s[i];
            continue;
        }
        if (!rev) {
            if (s[i] == t[t.size() - 1]) {
                t.pop_back();
                continue;
            }
            t += s[i];
        }
        if (rev) {
            if (s[i] == t[0]) {
                t.erase(t.begin());
                continue;
            }
            t.insert(0, {s[i]});
        }
    }
    string ans = "";
    if (!rev) ans = t;
    if (rev) {
        for (int i = t.size() - 1; i >= 0; i--) ans += t[i];
    }
    cout << ans << endl;
}

#include<bits/stdc++.h>
using namespace std;
#define gc() getchar()
#define pc(a) putchar(a)
#define int long long
#define inf (1ll<<60)
inline int read()
{
    int x=0,f=1;
    char c=gc();
    while(c<'0'||c>'9')
    {
        if(c=='-') f=-f;
        c=gc();
    }
    while(c>='0'&&c<='9') x=x*10+c-'0',c=gc();
//    cout<<x<<endl;
    return x*f;
}
int nnu[25];
inline void write(int x)
{
    if(x<0) pc('-'),x=-x;
    if(!x)
    {
        pc('0');
        return;
    }
    int tp=0;
    while(x) nnu[++tp]=x%10,x/=10;
    while(tp) pc(nnu[tp--]+'0');
    return;
}
#define ma 500005
char s[ma];
int cnt[ma];
signed main()
{
	int A=read(),B=read(),C=read(),D=read();
	B=D*C-B;
//	cout<<B<<endl;
	if(B<=0) puts("-1");
	else cout<<(int)max(0.0,ceil(1.0*A/B));
}






