#include <bits/stdc++.h>
using namespace std;
long long n, ar[500005 + 5];
int main() {
  long long i, j, k, a, b;
  while (scanf("%lld%lld%lld", &n, &a, &b) == 3) {
    long long x = (a % n + (b % n + n) % n + n) % n;
    if (x == 0) x = n;
    printf("%lld\n", x);
  }
  return 0;
}
