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