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