#include <bits/stdc++.h>
using namespace std;
map<int, vector<pair<int, int>>> mp;
int dep[20001]{0}, mx = -1;
bool visit[2001]{0};
int dfs(int c) {
  if (visit[c] == 1) {
    return dep[c];
  }
  visit[c] = 1;
  for (int i = 0; i < (int)mp[c].size(); i++) {
    int x, sum = 0;
    x = mp[c][i].first;
    sum = dfs(x);
    dep[c] = max(dep[c], ++sum);
  }
  return dep[c];
}
int main() {
  int n, a, b;
  cin >> n >> a >> b;
  if (b > 0) {
    for (int i = 0; i < b; i++) {
      a++;
      if (a > n) a = 1;
    }
  } else {
    b *= -1;
    for (int i = 0; i < b; i++) {
      a--;
      if (a == 0) a = n;
    }
  }
  cout << a;
  return 0;
}
