#include using namespace std; #define mp make_pair #define F first #define S second #define pb push_back #define fo(i, n) for(int i = 1; i <= n; ++i) typedef long long ll; typedef pair pii; typedef pair pll; const int N = 200200; const int mod = 1e9 + 7 ; int main() { ios::sync_with_stdio(0); cin.tie(0); int m,p,d,s; int cnt=0; cin>>p>>d>>m>>s; while(true) { if(s