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