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