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