#include <bits/stdc++.h>   using namespace std;   template <typename T>   inline T read() {     T s = 0, f = 1;     char ch = getchar();     while (!isdigit(ch)) {       if (ch ==  - ) f = -1;       ch = getchar();     }     while (isdigit(ch)) {       s = (s << 3) + (s << 1) + ch - 48;       ch = getchar();     }     return s * f;   }   template <typename T>   inline void print(T x) {     if (x < 0) putchar( - ), x = -x;     if (x > 9) print(x / 10);     putchar(x % 10 +  0 );   }   const int N = 2e5 + 100;   const int mod = 1e9 + 7;   long long h[N], w[N], sum[N];   struct Segment {     static const int maxn = 2e5 + 100;     struct star {       long long lsum, rsum, sum;     } s[maxn << 2];     void pushup(int node, int l, int r) {       int mid = l + r >> 1;       s[node].lsum =           max(s[node << 1].lsum, h[l] + sum[mid - 1] - sum[l - 1] +                                      s[node << 1 | 1].lsum - h[mid + 1] + w[mid]);       s[node].lsum = max(s[node].lsum, h[l] + h[mid + 1] + sum[mid] - sum[l - 1]);       s[node].rsum =           max(s[node << 1 | 1].rsum,               h[r] + sum[r - 1] - sum[mid] + s[node << 1].rsum - h[mid] + w[mid]);       s[node].rsum = max(s[node].rsum, h[r] + h[mid] + sum[r - 1] - sum[mid - 1]);       s[node].sum = max(s[node << 1].rsum + s[node << 1 | 1].lsum - h[mid] -                             h[mid + 1] + w[mid],                         max(s[node << 1].sum, s[node << 1 | 1].sum));       s[node].sum = max(s[node].sum, max(s[node].lsum, s[node].rsum));       s[node].sum = max(s[node].sum, h[r] + h[l] + sum[r - 1] - sum[l - 1]);       s[node].sum = max(           s[node].sum, max(s[node << 1].rsum - h[mid] + h[mid + 1] + w[mid],                            s[node << 1 | 1].lsum - h[mid + 1] + h[mid] + w[mid]));       s[node].sum = max(s[node].sum, h[mid] + h[mid + 1] + w[mid]);     }     void build(int node, int l, int r) {       if (l == r) {         s[node].lsum = s[node].rsum = h[l];         s[node].sum = 0;         return;       }       int mid = l + r >> 1;       build(node << 1, l, mid);       build(node << 1 | 1, mid + 1, r);       pushup(node, l, r);     }     star query(int node, int l, int r, int L, int R) {       if (L == l && R == r) {         return s[node];       }       int mid = l + r >> 1;       if (R <= mid)         return query(node << 1, l, mid, L, R);       else if (L > mid)         return query(node << 1 | 1, mid + 1, r, L, R);       else {         star lnode = query(node << 1, l, mid, L, mid);         star rnode = query(node << 1 | 1, mid + 1, r, mid + 1, R);         star now;         now.lsum = max(lnode.lsum, h[L] + sum[mid - 1] - sum[L - 1] + rnode.lsum -                                        h[mid + 1] + w[mid]);         now.lsum = max(now.lsum, h[L] + h[mid + 1] + sum[mid] - sum[L - 1]);         now.rsum = max(rnode.rsum, h[R] + sum[R - 1] - sum[mid] + lnode.rsum -                                        h[mid] + w[mid]);         now.rsum = max(now.rsum, h[R] + h[mid] + sum[R - 1] - sum[mid - 1]);         now.sum = max(lnode.rsum + rnode.lsum - h[mid] - h[mid + 1] + w[mid],                       max(lnode.sum, rnode.sum));         now.sum = max(now.sum, max(now.lsum, now.rsum));         now.sum = max(now.sum, h[L] + h[R] + sum[R - 1] - sum[L - 1]);         now.sum = max(now.sum, max(lnode.rsum - h[mid] + h[mid + 1] + w[mid],                                    rnode.lsum - h[mid + 1] + h[mid] + w[mid]));         now.sum = max(now.sum, h[mid] + h[mid + 1] + w[mid]);         return now;       }     }   } tree;   int main() {     int n = read<int>(), m = read<int>();     for (int i = 1; i <= n; ++i) {       w[i] = read<long long>();       w[i + n] = w[i];       sum[i] = sum[i - 1] + w[i];     }     for (int i = 1; i <= n; ++i) {       h[i] = read<long long>();       h[i] = h[i] + h[i];       h[i + n] = h[i];     }     for (int i = n + 1; i <= n + n; ++i) {       sum[i] = sum[i - 1] + w[i];     }     tree.build(1, 1, n + n);     for (int i = 1; i <= m; ++i) {       int l = read<int>(), r = read<int>();       int lc, rc;       if (r >= l)         lc = r + 1, rc = l + n - 1;       else         lc = r + 1, rc = l - 1;       printf( %lld n , tree.query(1, 1, n + n, lc, rc).sum);     }   }