#include <stdio.h>

int main() {
    int A;
    int B;
    int C;
    int T;
    int addCount;

    scanf("%d %d %d", &A, &B, &C);
    scanf("%d", &T);

    int overTime = T-30;
    
    while(1) {
        if(T <= 30) {
            printf("%d", A);
            break;
        }

        while(1) {
            overTime -= B;
            addCount++;
            if(overTime <= 0) break;
        }

        A += addCount*C;
        break;
    }

    printf("%d", A);
    
    return 0;
}

Embed on website

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