#include <bits/stdc++.h>
using namespace std;
const long long M = 2e5 + 10, oo = 1e9 + 7;
bool cmp(pair<long long, long long> &a, pair<long long, long long> &b) {
  if (a.first == b.first) return a.second > b.second;
  return a.first < b.first;
}
map<pair<long long, long long>, long long> mp;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, a, b, pos;
  cin >> n >> a >> b;
  pos = (a + b) % n;
  if (pos < 0) pos += n;
  pos %= n;
  if (pos == 0) pos = n;
  cout << pos << endl;
  return 0;
}
