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