#include <bits/stdc++.h>
using namespace std;
long long i, j, t, n, k, a, b;
double v;
string line;
char s[4];
int main() {
  while (cin >> n >> a >> b) {
    if (b < 0) b = n + b;
    a = a + b;
    a = a % n;
    if (a == 0)
      a = n;
    else if (a < 0)
      a = n + a;
    cout << a;
    cout << endl;
  }
  return 0;
}
