#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, a, b;
  cin >> n >> a >> b;
  long long int r = b % n;
  while (b < 0) {
    b += n;
  }
  b = b % n;
  a = a + b;
  if (a > n) {
    a = a % n;
  }
  cout << a;
}
