n=int(input())
h=0
h=list(map(int,input().strip().split()))
h=h[0]
w=0
w=sum(list(map(int,input().strip().split())))
const=500000004
w = w % (10**9+7)
ans=h
ans=(ans*(h+1))%(10**9+7)
ans=(ans*w)%(10**9+7)
ans=(ans*(w+1))%(10**9+7)
ans=(ans*const)%(10**9+7)
ans=(ans*const)%(10**9+7)
print(ans)
bj1pbnQoaW5wdXQoKSkKaD0wCiAKaD1saXN0KG1hcChpbnQsaW5wdXQoKS5zdHJpcCgpLnNwbGl0KCkpKQpoPWhbMF0Kdz0wCiAKdz1zdW0obGlzdChtYXAoaW50LGlucHV0KCkuc3RyaXAoKS5zcGxpdCgpKSkpCmNvbnN0PTUwMDAwMDAwNAp3ID0gdyAlICgxMCoqOSs3KQphbnM9aAphbnM9KGFucyooaCsxKSklKDEwKio5KzcpCmFucz0oYW5zKncpJSgxMCoqOSs3KQphbnM9KGFucyoodysxKSklKDEwKio5KzcpCmFucz0oYW5zKmNvbnN0KSUoMTAqKjkrNykKYW5zPShhbnMqY29uc3QpJSgxMCoqOSs3KQpwcmludChhbnMp