#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, a, b;
  cin >> n >> a >> b;
  int walk = a + b;
  if (walk < 0)
    walk += ceil((double)abs(walk) / n) * n;
  else if (walk > n)
    walk %= n;
  if (walk == 0) walk = n;
  cout << walk;
  return 0;
}
