#include <bits/stdc++.h>
using namespace std;
int quick_pow(int a, int b, int MOD) {
  a %= MOD;
  int res = 1;
  while (b) {
    if (b & 1) res = (res * a) % MOD;
    b /= 2;
    a = (a * a) % MOD;
  }
  return res;
}
const int maxn = 100000 + 10;
int main() {
  int i, j, n, m, a, b;
  while (scanf("%d%d%d", &n, &a, &b) != EOF) {
    int f = 1;
    if (b == 0) {
      printf("%d\n", a);
      continue;
    }
    if (b < 0) {
      f = -1;
      b = -b;
    }
    while (b--) {
      a += f;
      if (a < 1) a = n;
      if (a > n) a = 1;
    }
    printf("%d\n", (a));
  }
  return 0;
}
