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