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