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