package com.study.demo; import java.util.Scanner; public class test3_5 { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); int[] t = new int[n - 1]; int[] s = new int[n]; for (int i = 0; i < n - 1; i++) { t[i] = scanner.nextInt(); } for (int i = 0; i < n; i++) { s[i] = scanner.nextInt(); } int x = scanner.nextInt(); int y = scanner.nextInt(); int total = 0; if (x < y) { for (int i = x - 1; i < y - 1; i++) { total += s[i] + t[i]; } total += s[y - 1]; } else { for (int i = x - 1; i >= y; i--) { total += s[i] + (i > 0 ? t[i - 1] : 0); } total += s[y - 1]; } System.out.println(total); } }