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