#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define ALL(a)  (a).begin(),(a).end()

const int INF = 1 << 30;
const int MOD = 1e9 + 7;
const long long LINF = 1LL << 60;
const double PI = 3.141592653589793;
const int NIL = -1;
const int MAX = 1100000;
const int LARGE = 10000;

double X, Y, R;
ll XX, YY, RR;

bool inside(ll x, ll y) {
    x *= LARGE; y *= LARGE;
    return (x - XX) * (x - XX) + (y - YY) * (y - YY) <= RR * RR;
}

ll calc_lower(ll x) {
    ll ok = floor(Y);
    ll er = ok - floor(R) - 10;
    if (!inside(x, ok)) return 0;
    while(abs(ok - er) > 1) {
        ll mid = (ok + er) / 2;
        if (inside(x, mid)) ok = mid;
        else er = mid;
    }
    return floor(Y) - er;
}

ll calc_upper(ll x) {
    ll ok = floor(Y) + 1;
    ll er = ok + floor(R) + 10;
    if (!inside(x, ok)) return 0;
    while(abs(ok - er) > 1) {
        ll mid = (ok + er) / 2;
        if (inside(x, mid)) ok = mid;
        else er = mid;
    }
    return er - (floor(Y) + 1);
}


int main() {
    cin >> X >> Y >> R;
    XX = (ll) round(X * LARGE);
    YY = (ll) round(Y * LARGE);
    RR = (ll) round(R * LARGE);

    ll ans = 0;
    for (ll x = floor(X - R - 10); x < floor(X + R + 10); x++) {
        ans += calc_upper(x) + calc_lower(x);
    }
    cout << ans << endl;
}

#include <cstdio>
#include <climits>
#include <cmath>
#include <iostream>
#include <cstdio>
#include <climits>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <string>
#include <cstdio>
#include <climits>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <utility>
#include <queue>
#include <cstring>
#include <set>
#include <map>
#include <complex>
#include <tuple>

#define rep(i, n) for (int i = 0; i < int(n); i++)
using namespace std;
long long MOD = 1000000007;
long long INF = 1000000000000000000; //10^18
typedef long long ll;
typedef unsigned long long ull;


/*ll powMod(ll x, ll n, ll mod) {
  if (n == 0) return 1;
  ll t = powMod(x, n/2, mod);
  t = t * t % mod;
  if (n & 1) return t * x % mod;
  return t;
}

ll gcd(ll a, ll b) {
  if (a == 0 || b == 0) return a + b;
  if (b > a) return gcd(b, a);
  return gcd(b, a % b);
  }*/

int main(void) {
  ll n, a[100100];
  cin >> n;
  rep(i, n) cin >> a[i];

  ll x[100100][3], y[100100][3];

  if (n == 1) {
    cout << a[0] << endl;
    return 0;
  }

  x[1][1] = (a[0] + a[1]) % MOD;
  x[1][0] = (a[0] - a[1] + MOD) % MOD;
  y[1][1] = 1;
  y[1][0] = 1;

  for (int i = 2; i < n; i++) {
    y[i][1] = (y[i-1][1] + y[i-1][0])%MOD;
    y[i][0] = y[i-1][1];
    
    x[i][1] = (x[i-1][1] + a[i]*y[i-1][1]%MOD)%MOD;
    x[i][1] += (x[i-1][0] + a[i]*y[i-1][0]%MOD)%MOD;
    x[i][1] %= MOD;

    x[i][0] = (x[i-1][1] - a[i]*y[i-1][1]%MOD + MOD)%MOD;
  }
  //cout << y[n-2][0] << " " << y[n-2][1] << endl;

  cout << (x[n-1][0] + x[n-1][1])%MOD << endl;

  return 0;
}

    
    
