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