已过样例,但全红
#include<bits/stdc++.h>
using namespace std;
long long n,x,y,a,b,maxx,z,s,m,h,l,ql,j;
int main(){
cin>>n>>x>>y>>a>>b;
while(n--){
cin>>s>>m>>h;
h=h-s-m;
if(!h){
l++;
ql=0;
if(l>=b)j/=2;
}
else{
l=0;
ql++;
j+=h;
if(h>s+m)j=ceil(0.5*h)+j;
if(ql>=a)j*=2;
}
if(maxx<j)maxx=j;
}
cout<<maxx<<" "<<j<<endl;
return 0;
}