#include <bits/stdc++.h>
int main() {
  int n, a, b;
  scanf("%d", &n);
  scanf("%d", &a);
  scanf("%d", &b);
  b = b % n;
  if ((n + a + b) % n != 0)
    printf("%d\n", (n + b + a) % n);
  else
    printf("%d\n", n);
}
