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