#include <stdio.h>

int main() {
    int h, p, f, d;
    scanf("%d", &h);
    scanf("%d", &p);
    scanf("%d", &f);
    scanf("%d", &d);
    if(d== -1){
        while(1){
            if(f!=0) f--;
            else     f = 15;
            if(f==h){
                printf("S");
                break;
            }
            else if(f==p){
                printf("N");
                break;
            }
        }
    }
    else{
        while(1){
            if(f!=15) f++;
            else     f = 0;
            if(f==h){
                printf("S");
                break;
            }
            else if(f==p){
                printf("N");
                break;
            }
        }
    }
    
    return 0;
}

Embed on website

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