#include <bits/stdc++.h>
using namespace std;
double EPS = 1e-9;
int conversion(string p) {
  int o;
  o = atoi(p.c_str());
  return o;
}
string toString(int h) {
  stringstream ss;
  ss << h;
  return ss.str();
}
long long gcd(long long a, long long b) { return (b == 0 ? a : gcd(b, a % b)); }
long long lcm(long long a, long long b) { return (a * (b / gcd(a, b))); }
long long toi(string p) {
  long long x;
  istringstream in(p);
  in >> x;
  return x;
}
long long square(long n) { return n * n; }
long long fastexp(long base, long power) {
  if (power == 0)
    return 1;
  else if (power % 2 == 0)
    return square(fastexp(base, power / 2));
  else
    return base * (fastexp(base, power - 1));
}
bool is_prime(int n) {
  for (int i = 2; i * i <= n; i++)
    if (n % i == 0) return 0;
  return 1;
}
int logba(int a, int b) { return log(a) / log(b); }
int rd(double d) {
  int x = (int)((double)d + 0.5);
  return x;
}
int main() {
  int a, b, c;
  cin >> a >> b >> c;
  if (c < 0) {
    if (abs(c) < a)
      c += a;
    else
      c = (a * (abs(c) / a + (abs(c) % a != 0)) + c);
  }
  if ((b + c) % a == 0)
    cout << a << endl;
  else
    cout << (b + c) % a << endl;
}
