#include <stdio.h>

int main() {
    int n, d, a, Quant=0;
    scanf("%d", &n);
    scanf("%d", &d);
    scanf("%d", &a);
    while(1){
        if(a != d){
          if(a < n){
              a++;
          }
          else{
              a = 1;
          }
            Quant++;
        }
        else{
            break;
        }
        
    }
    printf("%d", Quant);
    return 0;
}

Embed on website

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