#include <bits/stdc++.h>
using namespace std;
long long bs(long long arr[], long long l, long long r, long long x) {
  if (r >= l) {
    long long mid = l + (r - l) / 2;
    if (arr[mid] == x) return mid;
    if (arr[mid] > x) return bs(arr, l, mid - 1, x);
    return bs(arr, mid + 1, r, x);
  }
  return -1;
}
bool isprime(unsigned long long n) {
  if (n <= 1) return false;
  if (n <= 3) return true;
  if (n % 2 == 0 || n % 3 == 0) return false;
  for (unsigned long long i = 5; i * i <= n; i = i + 6)
    if (n % i == 0 || n % (i + 2) == 0) return false;
  return true;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n, a, b, ans;
  cin >> n >> a >> b;
  ans = a + b;
  if (ans > n || ans < 1) ans %= n;
  if (ans <= 0) ans += n;
  cout << ans;
}
