#include <bits/stdc++.h>                                                                      
                                                                                              
using namespace std;                                                                          
                                                                                              
#define all(x) x.begin(), x.end()                                                             
#define rep(i, n) for (int i = 0; i < n; ++i)                                                 
#define reps(i, m, n) for (int i = m; i <= n; ++i)                                            
                                                                                              
using i64 = long long;                                                                        
using pii = pair<i64, i64>;                                                                   
                                                                                              
template<class A, class B>inline bool chmax(A &a, const B &b){return b > a ? a = b,1 : 0;}    
template<class A, class B>inline bool chmin(A &a, const B &b){return b < a ? a = b,1 : 0;}    
                                                                                              
constexpr int INF = 0x3f3f3f3f;                                                               
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;                                                    
constexpr int mod = int(1e9) + 7;                                                             
                                                                                              
int n, m, p;                                                                                  
int d[100010];                                                                                
                                                                                              
signed main()                                                                                 
{                                                                                             
  ios::sync_with_stdio(false);                                                                
  cin.tie(nullptr);                                                                           
                                                                                              
  cin >> n >> m >> p;                                                                         
                                                                                              
  rep(i, m) {                                                                                 
    cin >> d[i];                                                                              
    d[i] = (d[i] - p + n) % n;                                                                
  }                                                                                           
                                                                                              
  sort(d, d + m);                                                                             
                                                                                              
  int ans = min(n - d[0], d[m-1]);                                                            
  rep(i, m) {                                                                                 
    int r = d[i];                                                                             
    int l = n - d[i+1];                                                                       
    ans = min(ans, min(r * 2 + l, l * 2 + r));                                                
  }                                                                                           
                                                                                              
  cout << ans * 100 << "\n";                                                                  
                                                                                              
  return 0;                                                                                   
}                                                                                             


Measured memory_bytes: 3200