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