#include<stdio.h>
int MAX(int a,int b){return a<b?b:a;}
int main(){
  int n,t,h,a,b,i,d[3010]={0};
  scanf("%d %d %d",&n,&t,&h);
  while(n--){
    scanf("%d %d",&a,&b);
    for(i=t;i>-1;i--){
      if(i<h&&h<i+b&&i+b<=t)continue;
      d[i+b]=MAX(d[i+b],d[i]+a);
    }
    for(i=1;i<t;i++)d[i]=MAX(d[i-1],d[i]);
    //for(i=0;i<t;i++)printf("%2d ",d[i]);printf("\n");
  }
  printf("%d\n",d[t]);
  return 0;
}