#include <stdio.h>

int main() {
    int B, Q=0;
    scanf("%d", &B);
    int C[B], L[B];
    for(int i=0; i<B; i++){
        scanf("%d %d", &L[i], &C[i]);
        if(L[i]>C[i]){
    return 0;
            Q=Q+C[i];
        }      
    }

    printf("%d", Q);
    
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: