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