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