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