#include <bits/stdc++.h>
using namespace std;
const auto INF = 0x3f3f3f3f;
const int N = 1e5 + 5;
bool ok(int p, int x) {
  int i = (x / 50) % 475;
  for (int k = 1; k <= 25; k++) {
    i = (i * 96 + 42) % 475;
    if (i + 26 == p) {
      return true;
    }
  }
  return false;
}
int main() {
  int p, x, y;
  scanf("%d%d%d", &p, &x, &y);
  int answer = -1;
  for (int i = 0; i <= 1000; i++) {
    if (answer != -1) break;
    for (int j = 0;; j++) {
      int temp = x + i * 100 - 50 * j;
      if (temp < y) break;
      if (ok(p, temp)) {
        answer = i;
        break;
      }
    }
  }
  printf("%d\n", answer);
}
