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