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