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

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n,m,p,q;cin >> n >> m >> p >> q;
	int ans=0,i=1;
	while(n>0){
		if(i>=p && i<p+q){
			n-=2*m;
		}
		else n-=m;
		i++;
		if(i>12) i=1;
		ans++;
	}
	cout << ans << endl;
}