#include <bits/stdc++.h>
using namespace std;
int n, a, b, res;
bool boo(false);
int main() {
  scanf("%d %d %d", &n, &a, &b);
  b %= n;
  res = a + b;
  while (!boo) {
    if ((res > 0) && (res <= n)) {
      boo = true;
    } else {
      if (res <= 0) {
        res += n;
      } else if (res > n) {
        res -= n;
      }
      boo = false;
    }
  }
  printf("%d\n", res);
}
