#include <bits/stdc++.h>
using namespace std;
ifstream fin(".in");
ofstream fout(".out");
int n, a, b;
int main() {
  cin >> n >> a >> b;
  int k = a + b;
  k %= n;
  if (k == 0)
    cout << n;
  else {
    k += n;
    k %= n;
    cout << k;
  }
  return 0;
}
