#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a, b;
  scanf("%d %d %d", &n, &a, &b);
  a--;
  a += b;
  a %= n;
  if (b < 0) a = (a + n) % n;
  a++;
  cout << a << endl;
  return 0;
}
