#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a, b, fpos;
  cin >> n >> a >> b;
  if (b == 0)
    cout << a;
  else if (b > 0) {
    b = b % n;
    int diff = n - a;
    if (diff >= b) {
      fpos = a + b;
      cout << fpos;
    } else {
      b = b - diff;
      fpos = b;
      cout << b;
    }
  } else {
    b = abs(b);
    b = b % n;
    int diff = a - 1;
    if (diff >= b) {
      fpos = a - b;
      cout << fpos;
    } else {
      b = b - diff;
      b--;
      fpos = n - b;
      cout << fpos;
    }
  }
  return 0;
}
