#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:102400000,102400000")
using namespace std;
int main() {
  int a, n, b;
  scanf("%d%d%d", &n, &a, &b);
  while (b < 0) {
    b = n + b;
  }
  int k = (a + abs(b)) % n;
  if (k == 0)
    cout << n << endl;
  else
    cout << k << endl;
  return 0;
}
